I was just asked a question in a technical interview that I was a bit confused about.
The question was as follows:
If
int i = -1, int j = -1, and int k = -1,
and we run the following line:
++i && ++j && ++k
what would be the new values of i, j, and k? The reason I was confused is that, since we are not assigning this expression to anything, it doesn't seem like the and operators should make any difference (only the increment operators should). However, running a simple test program quickly proved that I was mistaken. Could someone explain this to me, as I have never seen this exercise before.