1 votes 1 votes When the following code is executed what will be the value of x and y? int x=1, y=0; y=x++; 2, 1 2, 2 1, 1 1, 2 Others ugcnetcse-june2013-paper2 + – go_editor asked Jul 13, 2016 go_editor 2.8k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 1 votes 1 votes // postfix b++; // returns b then increases b // prefix ++b; // increases b then returns b int x=1, y=0; y=x++;returns y then increases x Output:-x=2 , y=1 Hence,Option(A)2,1. LeenSharma answered Jul 13, 2016 • selected Jul 13, 2016 by asu LeenSharma comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes since it is post increment operator y=1 and x=2 hence option A is correct . be careful not to choose D by mistake Sanjay Sharma answered Jul 13, 2016 Sanjay Sharma comment Share Follow See all 0 reply Please log in or register to add a comment.