Sum, Difference, Increment, Decrement
Sum operator (+)
The addition operator
+ sums the values on both sides of the
Instead of any values, you can use variables:
In some programming languages, it is possible to sum strings, for example, "Hell" + "o" = "Hello", but not in C.
Difference operator (-)
- difference operator forms the difference between the values on both sides of the
You can use the
- sign to change positive values to negative values.
Increment operator (++)
The increment operator was created to make the code easier to read.
This operator means
+1 and is typically used in loops. This is the simplest form of using this operator.
Decrement operator (--)
The decrement operator, on the other hand, means
Post and Prefix Increment
Increment and decrement have two forms:
- prefix (++a);
- postfix (a++).
They differ in that they return different values.
b equals 7, what
b++ equals to?
Select the correct answer
Everything was clear?