What will i and j equal after the code below is executed? Explain your answer. int i = 5; int j = i++; | Sololearn: Learn to code for FREE!

+2

What will i and j equal after the code below is executed? Explain your answer. int i = 5; int j = i++;

c++

9/8/2016 6:25:49 PM

Aklil Asregid

4 Answers

New Answer

+5

i = 6 j = 5

0

j=5 and i=6 now do you understandđŸ˜‰.

0

I=6 j=5 because i++ first assign then valu of i to j and then it will incremwnt the value of i i++ increments the variable after it is used

-1

i = 5, j = 5 Pre-incrementation (++i) increments the variable before it is used. Post-incrementation (i++) increments the variable after.