how will you diffrentiate between ++ and -- operator? Explain it with an example
Answers
Answer:
++ increases the value of the given variable by 1 while -- operator decreases the value by 1.
Explanation:
a=3;
++a will give the value 4.
--a will give the value 2.
Hope it helps!
Please mark as brainliest..!
Hi there !
Here's your answer :
•°•°•°•°•°<><><><<><>><><>•°•°•°•°•°•°
Here there are two types :
- Increment Operator => ++
- Decrement Operator => --
Both of the operations depends on the position of the operand and the operator.
¶¶¶ Based on the position, each of these operations are 2 types:
- Prefix Increment (Eg: ++x)
- Postfix Increment (Eg: x++)
The prefix increment returns the value of a variable after it has been incremented.
On the other hand, the more commonly used postfix increment returns the value of a variable before it has been incremented.
¶¶¶ //y with the Decrement :
- Postfix Increment (Eg: --x )
- Postfix Decrement (Eg: x-- )
The prefix decrement returns the value of a variable after it has been decremented.
On the other hand, the more commonly used postfix decrement returns the value of a variable before it has been decremented.
•°•°•°•°•°<><><><<><>><><>•°•°•°•°•°•°
.
Hope it helps