Possible Duplicate:
Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc…)
#include<stdio.h>
int main()
{
char a[]="Hello";
char *p=a;
while(*p)
++*p++; //Statement 2
printf("%s",a);
int x=10;
++x++; //Statement 1
return 0;
}
When i compile this code i get an l-value Required error in Statement 1, which i can understand. How is that statement 2 does not produce an error even though i intend to do the same thing? Can someone shed light?