Well, I'm not really in serious need of this answer, I am just inquisitive.
Expressions like *ptr++ = a
are perfectly valid since we are operating on two objects ptr
and *ptr
but if i write *ptr++ = *ptr + a
is it still valid ?
For example consider the following snippet:
int main(void){
int a[] = {5,7,8,9,2};
int* p =a;
*p++ = 76; /*altering the first element */
*p++ = *p + 32; /*altering the second element */
p = a;
int i;
for(i = 0;i<5; i++)
printf("%d ",*p++);
return 0;
}
I think that there is nothing to worry about with the expression *p++ = *p + 32;
but I am unsure about the sequence points involved.