Monday, December 9, 2013

Mind Re-Fresher Queston

Hola Amigos,

Here is a mind refreshing question for you all. You remember increment (++) operator. Of-course you do .....

Then tell me the difference between y++ and ((y+=1)-1) ?


Ans: Both are same statements

if y = 1

and a = y++ => a = 1; y = 2

and if a= ((y+=1)-1) =>   y+=1 = 2  
=>   ((2) -1) => a = 1; y = 2