Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

++i vs i++

// ++i will increment the value of i, and then return the incremented value.

 i = 1;
 j = ++i;
 (i is 2, j is 2)

// i++ will increment the value of i, but return the original value that i held before being incremented.

 i = 1;
 j = i++;
 (i is 2, j is 1)

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
9+7 =