&& and || operator confusion
Can anyone explain me the results of the following program....
According to my understanding
m=++i && ++j || ++k;
printf("%d %d %d %d",i.j,k,m);
&& operation will be the first one to execute....when compared to || so....
++i will be -2
++j will be 3
since ++i and ++j are used in an expressin (&&) these two values will be incremented first and then logical && operator will be applied...Please correct me if i am wrong.
so the result will be 0
this 0 is logically OR'ed with ++k;
++k will be 1 now.(since it is used in expression)
0 || 1 will result in 1
so the output must be....
-2,3,1,1....but when i type the program and execute in GCC
its giving the output
I didn't understand why k is not getting incremented....
Please give me some explanation or correct me if i am wrong.....