今天迅雷笔试题目关于func(++x,++x)的一个题目
- C/C++ code
#include<stdio.h>int func(int a,int b){ return a + 2 * b;}int main(){ int x = 100; cout<<func(++x,++x)<<endl; //system("pause"); return 0;}上面输出 306
下面这个输出 301
- C/C++ code
#include<stdio.h>int func(int a,int b){ return a + 2 * b;}int main(){ int x = 100; cout<<func(x++,x++)<<endl; //system("pause"); return 0;}求大神深度解答!!
[解决办法]
不同的编译器,结果可能不同吧。
这种题目没啥意义。
[解决办法]
看置顶的帖子!
[解决办法]
迅雷也搞这种烂题?
这是未定义行为,结果输出什么都是正确的
[解决办法]
又凌乱了一次 TC是304
[解决办法]
[解决办法]
[解决办法]
认真去看置顶帖,别浪费自己的生命了
[解决办法]