IT TRAINING INSTITUTE - Lesson Notes ================================================== Course: C++ Lesson: Increment and Decrement Operators, Prefix form and postfix form In C++, the increment operator (++) increases a variable's value by 1. There are two forms: 1. Prefix Increment — ++x In prefix, the variable is increased first, then its new value is used. int x = 5; int y = ++x; Result: x = 6 y = 6 Because x becomes 6 before assigning it to y. 2. Postfix Increment — x++ In postfix, the current value is used first, then the variable is increased by 1. int x = 5; int y = x++; Result: x = 6 y = 5 Because y gets the old value 5, and then x becomes 6. 🔑 Easy way to remember Form Example What happens first? Prefix ++x Increment → Use value Postfix x++ Use value → Increment Simple example int x = 10; cout << ++x; // 11 cout << x++; // 11 cout << x; // 12 Remember: Prefix = Change first Postfix = Use first Resource: file:resources/d95d242d274c93e2896ecf5620ce2c4d.pdf