Hi

I’m new to C.

I am troubled by y=x++;

I was reading the reference for ++, and the reference example gives:-

x = 2;

y = ++x; // x now contains 3, y contains 3

y = x++; // x contains 4, but y still contains 3

I can understand where I would use y=++x; (I am doing two things at once i.e. incrementing x and assigning it to y).

But where would you use y=x++;?

Surely if you are doing x=x+1, then y has got nothing to do with this operation, so why bother making it look like y is being assigned with y=x++;?

Thanks

Steve