I have been trying to figure out why the output of the code below is 2 2 but can't seem to figure out why. I get that the else statement is getting executed but from what I've read I can't understand why the first print doesn't get executed.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x = 1, y = 1;
if(x++ == y++)
printf("%d%d", x--, y--);
else
printf("%d%d", x,y);
return 0;
}
Originally I expected the output to be 0 0
I have played around with changing the values and the operators and each time the decrement print never executed. From what I can tell from reading on the topic decrementing inside a print should be possible but I'm not sure what is making it not execute.