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


 
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐