Increment in both side in C [closed]

For the original code:

x++ = y++

This line will never be evaluated because it is not legal C and will not be compiled. The result of x++ is not an lvalue and is not permitted on the left side of an assignment.

For the updated code:

float x,y;
*x++ = *y++

This is not legal because * cannot be applied to a float.

I will add this code:

float *x, *y;
*x++ = *y++;

This code says:

  • Let a temporary, say float *xt, equal x.
  • Let a temporary, say float *yt, equal y.
  • Add one to x.
  • Add one to y.
  • Assign *xt = *yt.

The actual operations may be performed in various orders, provide xt takes its value before x is updated, yt takes its value before y is updated, and xt and yt are defined before they are used.

Browse More Popular Posts

Leave a Comment