Hi everybody,
I was testing some code to check out outputs and I am a little bit confused on my results.
My test involved:
int a = 0, b = 1, c = -1;
c = a-- && b--;
printf("%d %d %d", a, b, c);
and the result I got was:
a = -1, b = 1, c = 0.
I'm a little bit confused as to why c turned into 0. Also, does the "&&" operation in the assignment of the c variable the same as using it in say, an if statement?
If any one could clarify this for me, that would be great.
Thanks.
Tags: