Click here to Skip to main content
15,898,732 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted
Updated 27-Oct-17 2:20am

Because you are a masochist programmer.
gcc gently hints:
warning: operation on 'b' may be undefined
before outputting -2 on my system.
 
Share this answer
 
v2
Operator precedence is not the factor. See here: Why does x = ++x + x++ give me the wrong answer?[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900