Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

pre increment vs post increment c++

b = x++;
// In this example suppose the value of variable ‘x’ is 5 then value of variable ‘b’ will be 5 because old value of ‘x’ is used.

b = ++y;
// In this example suppose the value of variable ‘y’ is 5 then value of variable ‘b’ will be 6 because the value of ‘y’ gets modified before using it in a expression.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pre #increment #post #increment
ADD COMMENT
Topic
Name
4+3 =