can anyone please explain me why the output is 3.And x-- should be 0.since it changes to 1 only in next place of x right ,as it is a post increment..Am i right ...Please explain this.
y=x++ + ++x; x++->the value of x is read first as -1 and then incremented to 0. ++x->the value of x is first incremented to 1 and then read. therefore the value of x is 1. now y= -1+1=0 and x=1 now x+ y+ ++x first expression are evaluated and then addition take place ++x->the value of x is first incremented to 2 and then read. now x+y+++x = 1+0+2=3