The increment operator is used to increase the value of a variable by 1. It is denoted by by symbol ++. It is a unary operator and work with single variable.
The increment operator cannot increment the value of constants and expressions.
For Example, A++ and X++ are Valid but 10++ is not Valid. (a+b)++ also invalid.
For Example, A++ and X++ are Valid but 10++ is not Valid. (a+b)++ also invalid.
The decrement operator is used to decrement the value of the variable by 1. It is denoted by symbol --. It is also a unary operator and work with single variable.
The decrement also cannot decrement the value of constant and expression. For Example, A-- and X-- are Valid but 10-- is invalid. Also (a+b)-- also invalid.
No comments:
Post a Comment