0
When does the x++ command get executed ? if its in a loop, still within the loop or after it is executed ? and how i have to understand !(1&&(1||0)) Thank you people, it would help me alot to understand that.
3 Answers
0
look there is difference between ++X &X++
basically in the loop it gets executed as per any normal command i.e. in given sequence.
your next questions answer is ..... go from inside to outside while reading bracket..... i.e. (1or0) then (1and given0 and finally the negative
0
++X : pre increment,
X++: post increment,
++X value of X is incremented first and then d equation along d line is performed while in X++ value of X is incremented after end of statement (;)..
consider
int X=5;
Cout <<X++;
Cout<<++X;
Out put:
5
7
Explanation :
5 because it is post increment so after 2 nd statement value of x=6 and output 7 because pre increment is used and value incremented before completion of 3 rd statement.
Nw ur next Que u have come across while solving challenges
Statement !(1&&(1||0))
Answer is "False".
u have to solve starting from innermost bracket
so que is 1||0 so answer is 1 .The || operator returns true(1) if either of a||b is true. Also 1&&1 is 1 and !1 is 0(False).
0
thank you guys, thats very helpfull, i think i got it now, and yea the logical bracket is something i saw many times in a challenge, and it cost me many times the win because i just dont got how to read that haha thank you very much