If x
and y
are pointers to the same variable variable,
what does *x++=*y++
mean?
int a,*x,*y;
*x++=*y++;
I expected an error but it didn't
If x
and y
are pointers to the same variable variable,
what does *x++=*y++
mean?
int a,*x,*y;
*x++=*y++;
I expected an error but it didn't
This expression is similar to
*x = *y;
x++;
y++;
The operators you see in *x++ = *y++
will be evaluated with regard to the C operator precedence rules. The increment ++
operator has a higher precedence than the dereference *
, but since we have a post-increment the operations will be carried out after the assignment.