#include <stdio.h> int main( ) { int a,b; float d,e; char c1,c2; double f,g; long m,n; unsigned int p,q; a=61;b=62; c1='a';c2='b'; d=3.56;e=-6.87; f=3157.890121;g=0.123456789; m=50000;n=-60000; p=32768;q=40000; printf("a=%d,b=%d\nc1=%c,c2=%c\n d=%6.2f,e=%6.2f\n",a,b,c1,c2,d,e); printf("f=%15.6f,g=%15.12f\nm=%ld,n=%ld\np=%u,q=%u\n",f,g,m,n,p,q); printf("sizeof(int):%dsizeof(int):%d\n,sizeof(float):%dsize(float):%d\n,sizeof(char):%dsizeof(char):%d\n",sizeof,sizeof,sizeof,sizeof,sizeof,sizeof); printf("sizeof(double):%dsizeof(double):%d\n,sizeof(long):%dsizeof(long):%d\n,sizeof(unsigned int):%dsizeof(unsigned int):%d\n",sizeof,sizeof,sizeof,sizeof,sizeof,sizeof); return 0; }
是最后的sizeof后应该加(),括号中应该写输出的格式吗?可是char的输出格式写c显示不正确,unsigned int 的输出格式u也显示不正确……求解答。
即如下所示
printf("sizeof(int):%dsizeof(int):%d\n,sizeof(float):%dsize(float):%d\n,sizeof(char):%dsizeof(char):%d\n",sizeof(d),sizeof(d),sizeof(f),sizeof(f),sizeof(c),sizeof(c)); printf("sizeof(double):%dsizeof(double):%d\n,sizeof(long):%dsizeof(long):%d\n,sizeof(unsigned int):%dsizeof(unsigned int):%d\n",sizeof(f),sizeof(f),sizeof(f),sizeof(f),sizeof(u),sizeof(u));
Yexiaomo
Rebellious_2016
相关分类