prefix, postfix, increment, decrement operators : prefix postfix increment decrement operators « Operators statements « C++ Tutorial






#include <iostream>
 
 int main()
 {
     int intValue = 39;      // initialize two integers
     int yourAge = 39;
     std::cout << intValue << "\n";
     std::cout << yourAge << "\n";
     intValue++;         // postfix increment
     ++yourAge;       // prefix increment
     std::cout << intValue << "\n";
     std::cout << yourAge << "\n";
     std::cout << intValue++ << "\n";
     std::cout << ++yourAge << "\n";
     std::cout << intValue << "\n";
     std::cout << yourAge << "\n";
     return 0;
 }
39
39
40
40
40
41
41
41








3.3.prefix postfix increment decrement operators
3.3.1.prefix, postfix, increment, decrement operators
3.3.2.Preincrementing and postincrementing