请教:关于c

本帖于 2004-06-29 08:23:30 时间, 由普通用户 hamburg 编辑

请问高手,一下程序输出结果应该是什么:

#include
int a=10,b=10;

main()
{
printf("\na++=%d ++a=%d",a++,++a);
printf("\nb++=%d",b++);
printf("\n++b=%d",++b);
return 0;
}

我的结果是:

a++=11 ++a=12
b++=10
++b=12
第一行的a++=11我想不通,怎么搞地?
谢谢!

所有跟帖: 

回复:不是11,你说是几? -深海鱼游- 给 深海鱼游 发送悄悄话 (20 bytes) () 06/28/2004 postreply 00:53:25

回复:所以问你 -深海鱼游- 给 深海鱼游 发送悄悄话 (68 bytes) () 06/28/2004 postreply 02:57:21

回复:请教:关于c: COMPILER BUG! -红辣椒- 给 红辣椒 发送悄悄话 (87 bytes) () 06/28/2004 postreply 10:36:07

回复:回复:请教:关于c: COMPILER BUG! -深海鱼游- 给 深海鱼游 发送悄悄话 (34 bytes) () 06/28/2004 postreply 10:49:54

那你可以用单步跟踪到PRINTF函数的内部看看它怎么搞的 -VC是带源码的- 给 VC是带源码的 发送悄悄话 (0 bytes) () 06/28/2004 postreply 12:55:34

回复:那你可以用单步跟踪到PRINTF函数的内部看看它怎么搞 -深海鱼游- 给 深海鱼游 发送悄悄话 (178 bytes) () 06/28/2004 postreply 13:41:44

这回知道为什么大家讨厌◎◎了 -是挺烦人的- 给 是挺烦人的 发送悄悄话 (108 bytes) () 06/28/2004 postreply 14:52:29

同意,应该是10,这题考的是++在函数前后的区别 -theApp- 给 theApp 发送悄悄话 (457 bytes) () 06/28/2004 postreply 15:24:19

你一个能代表大家吗? -想找不痛快?- 给 想找不痛快? 发送悄悄话 (0 bytes) () 06/29/2004 postreply 01:12:51

我用visual c++ 6.0 -意味深长- 给 意味深长 发送悄悄话 (37 bytes) () 06/29/2004 postreply 10:13:28

回复:我用visual c++ 6.0: 对的. -红辣椒- 给 红辣椒 发送悄悄话 (217 bytes) () 06/29/2004 postreply 12:33:53

回复:回复:我用visual c++ 6.0: 对的. -clowhand- 给 clowhand 发送悄悄话 (773 bytes) () 06/29/2004 postreply 20:45:35

one more comment -clowhand- 给 clowhand 发送悄悄话 (274 bytes) () 06/29/2004 postreply 20:53:17

don't understand? -pleaseexp- 给 pleaseexp 发送悄悄话 (295 bytes) () 06/30/2004 postreply 08:01:28

回复:don't understand? -clowhand- 给 clowhand 发送悄悄话 (380 bytes) () 06/30/2004 postreply 19:49:17

totally confused -goingcraz- 给 goingcraz 发送悄悄话 (259 bytes) () 06/30/2004 postreply 08:58:40

3! anwsers. Avoid! -红辣椒- 给 红辣椒 发送悄悄话 (13 bytes) () 06/30/2004 postreply 17:23:18

能解释吗? -真糊涂啦啦...- 给 真糊涂啦啦... 发送悄悄话 (0 bytes) () 06/30/2004 postreply 19:38:44

回复:能解释吗? -红辣椒- 给 红辣椒 发送悄悄话 (317 bytes) () 06/30/2004 postreply 19:47:15

这样看来,还是VC++合理些 -意味深长- 给 意味深长 发送悄悄话 (0 bytes) () 06/30/2004 postreply 19:46:01

Finally! got the answer, -fianlly- 给 fianlly 发送悄悄话 (81 bytes) () 07/01/2004 postreply 08:43:49

请您先登陆,再发跟帖!