首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

琐碎小疑点

2012-03-31 
琐碎小问题1.char a[]a0\na0\nsizeof(a)等于多少?是怎么算的?2.printf(%d,%d,++m,m)是先算++还是?我

琐碎小问题
1.char a[]="a0\na0\n"
  sizeof(a)等于多少?是怎么算的?
2.printf("%d,%d",++m,m)是先算++还是?我自己试的时候怎么感觉两种情况都出现过的呀?
3.printf("%d%d%d",m,n)这样的话是怎么用的?给具体讲讲呀!

[解决办法]
vs2008结果
1. 7,(a,0,'\n',a,0,'\n','\0');
2. 表达式的计算顺序应该是由编译器决定吧。记得好像是……。
C, like most languages, does not specify the order in which the operands of an operator are evaluated. (exceptions are && || ?: and ",") for example x = f() + g();
3. 输出2,3+随机值。
If there are more arguments than there are format specifications, the extra arguments are ignored. The results are undefined if there are not enough arguments for all the format specifications.




[解决办法]

探讨
1.char a[]="a0\na0\n"
sizeof(a)等于多少?是怎么算的?
2.printf("%d,%d",++m,m)是先算++还是?我自己试的时候怎么感觉两种情况都出现过的呀?
3.printf("%d%d%d",m,n)这样的话是怎么用的?给具体讲讲呀!

热点排行