输出是-1怎么样? [英] The output is -1 how?
本文介绍了输出是-1怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
void main()
{
int a = 1,b = 2,c;
c = ~a + ~b ++ + a + b ++;
printf(%d,c);
}
我尝试过:
根据运算符的优先级。
void main()
{
int a=1,b=2,c;
c=~a+~b+++a+b++;
printf("%d",c);
}
What I have tried:
according to the precedence of the operator.
推荐答案
因为你是受虐狂的程序员。
gcc
轻轻提示:
Because you are a masochist programmer.
gcc
gently hints:
warning: operation on 'b' may be undefined
在我的系统上输出 -2
之前。
before outputting -2
on my system.
运算符优先级不是因素。请参阅此处:为什么x = ++ x + x ++给我错误的答案? [ ^ ]
Operator precedence is not the factor. See here: Why does x = ++x + x++ give me the wrong answer?[^]
这篇关于输出是-1怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文