Differentiate b/w unary,birany and ternary operators.
Answers
Unary operators need only one operand to perform the task or operation.
e.g +, -, ++, -- etc
Here + & - operators will indicate the sign of operand. (e.g +5, -3, -45 )
The ++ & -- operators are called increament & decreament operators respectively.
The ++ operator will increase the value of operand by one & -- operator will decrease the value of operand by one. (e.g x++ or ++x = x+1 & x-- or --x = x-1)
Binary operators
Binary operators required two operands to perform the operation.
eg.+, -, *, /, % etc
Here these + & - operators will not indicate the sign of operand but add or substract two operands, because these are binary operators(e.g 3+5, 3–5)
Ternary operators
Ternary operators required three operands to perform the operation.