The difference comes when you use the post and pre increment in result
let say i = 5;
int j = i++; // j will contain i, i will be incremented.
now j will be 5 but i will become 6
int j = ++i; // i will be incremented, and j will contain the incremented i.
now j will be 6 and i will also be 6
Hope this helps!!
kunnu is back
Btw, more than 1 post increment in a statement in C/C++ = you cant predict the output. Thats what my professor told me when she was telling why these type of Q are not suitable for “Predict Output of following code”.
@vijju123 ^-^ what’s up!! ( ͡° ͜ʖ ͡°)