I am just starting out with C and I am stuck with a question in my book. It says the following:
x=1; y=1; if(n>0) x=x+1; y=y-1; printf("%d%d"x,y);
What will be the values of x and y if n assumes a value of a) 1 and b) 0.
Now when I run the program assuming n has a value of 1 then the output is x=2 and y=0 and when n is 0 then x=1 and y=0 (This is strange for me). Now when I run the same program using if else statement then I get X=2 Y=0 (Considering N is 1 here as well) and X=1 and Y=1 when N is 0 (This is what I agree with as well).
I am certain that either I do not have a clear concept here or maybe I am missing out on something. Any help is appreciated and Thanks in advance. Cheers !!