Other Convenient Operators
Explore convenient C operators such as prefix and postfix increment and decrement, along with compound assignment operators. Understand their effects on variables and when to use them explicitly to avoid confusion. This lesson helps build a solid foundation in writing concise and clear C expressions.
We'll cover the following...
We'll cover the following...
Some operators are convenient shorthands for what would normally be a two-step computation.
The ++ and -- operators
You may come across two unusual-looking operators that may be used as a shorthand for incrementing and decrementing variables. The ++ and -- operators add 1 and subtract 1, respectively, from their operands. For example in the following code snippet, we increment the int variable a and ...