post and pre increment in c
- by jammkie same
void main()
{
int a=2 , c;
c=a++ + ++a + ++a + ++a;
printf("%d",c);
}
prints 20, whereas
void main()
{
int a=2;
int c=a++ + ++a + ++a + ++a;
printf("%d",c);
}
prints 17.
Can someone explain the reason for this.