November 30, 2013

Operator precedence in C++

Operator precedence and associativity in C/C++ is not too much unintuitive but…

1
2
3
4
5
6
7
#include <stdio.h>
int main()
{
int i=5;
printf("%d%d%d%d%d",++i,i++,i,i--,--i);
return 0;
}