Increment and Decrement Operator in C
Increment and decrement operators in C The increment operator (++) increments the value of its operand by 1. x = 10; x++; // increments the value of x by 1. So, the value of x is 11. The decrement operator(--) decrements the value of its operand by 1; x = 10; x--; // decrements the value of x by 1; So, the value of x is 9. Both the operators can be placed before or after the operand as shown above and they can be applied on primitive data types like char, int, float, double & they can also be used on pointers and enums. Difference between postfix increment and prefix increment: Example 1: int a, b = 10; a = b++; Value of a is 10 Value of b is 11 In the above expression, the value of b is assigned to a first. Then, 1 is added to the value of b. Example 2: int a, b = 10 a = ++b; Value of a is 11 Value of b is 11 Here, the value of b is i...