如何评估? [英] how this is evaluated ?
本文介绍了如何评估?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int i = 0;
printf("%d%d%d%d",++ i,++ i,++ i,++ i) ;
输出:
4 3 2 1
为什么不是
1 2 3 4
int i=0;
printf("%d %d %d %d",++i,++i,++i,++i);
output:
4 3 2 1
why is not
1 2 3 4
推荐答案
sam写道:
int i = 0;
printf (%d%d%d%d,++ i,++ i,++ i,++ i);
int i=0;
printf("%d %d %d %d",++i,++i,++i,++i);
这有帮助吗?
http://www.eskimo.com /〜scs/C-faq/s3.html
Does this help?
http://www.eskimo.com/~scs/C-faq/s3.html
sam写道:
int i = 0;
printf("%d%d%d%d",++ i,++ i,++ i,++ i);
输出:
4 3 2 1
为什么不是
1 2 3 4
int i=0;
printf("%d %d %d %d",++i,++i,++i,++i);
output:
4 3 2 1
why is not
1 2 3 4
[laotseu @ localhost dev]
[laotseu@localhost dev]
gcc -Wall -ansi -pedantic -oorder order.c
order.c:在函数`main'':
order。 c:6:警告:i上的操作可能未定义
order.c:6:警告:i上的操作可能未定义
order.c:6:警告:i上的操作可能未定义
AFAIK,函数'args的评估顺序是
依赖于实现(至少这是我在K& R2中读到的)。
>
HTH
布鲁诺
gcc -Wall -ansi -pedantic -oorder order.c
order.c: In function `main'':
order.c:6: warning: operation on `i'' may be undefined
order.c:6: warning: operation on `i'' may be undefined
order.c:6: warning: operation on `i'' may be undefined
AFAIK, the evaluation order of a function''s args is
implementation-dependant (at least this is what I read in my K&R2).
HTH
Bruno
这篇关于如何评估?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文