double型,printf()用%f输出,而scanf用%lf来接受输入。
| 格式 |
printf |
scanf |
| %c |
int |
char * |
| %d, %i |
int |
int * |
| %o, %u, %x |
unsigned int |
unsigned int * |
| 格式 |
printf |
scanf |
| %ld, %li |
long int |
long int * |
| %lo, %lu, %lx |
unsinged long int |
unsigned long int * |
| %hd, %hi |
int |
short int * |
| %ho, %hu, %hx |
unsigned int |
unsigned short int * |
| %e, %f, %g |
double |
float * |
| %le, %lf, %lg |
n/a |
double * |
| %s |
char * |
char * |
| %[...] |
n/a |
char * |
| %p |
void |
void ** |
| %n |
int * |
int * |
| %% |
none |
none |