Friday, February 8, 2013

output of following code

What is output of following code?
int main()
{
   int a = 5, b = 6, c;
   c = a+++b;
   printf("%d", c);

   return 0;
}


O/P: 11 
Explanation: "++" operator has high precedence than "+" operator  
So, it is solved as c = (a++) + b;
     Not as c = a + (++b) 
See Operator Precedence here

No comments:

Post a Comment