Anonymous

what is difference between unary operator and binary operator in c++ programming?

3

3 Answers

Lia Tan Profile
Lia Tan answered

A unary operator operates on a single operand while a binary operator operates on a two operands.

For instance, a unary minus simply makes the operand negative. For example, if your operand is 5, a unary minus will make it -5. A binary minus operates on two different operands, subtracting one from another. So if the two operands are 5 and 3, applying a binary minus will result in 5-3 = 2.

Florio Potter Profile
Florio Potter answered

Unary '-' : It is used with a single operand and that is why it is an unary operator.Binary '-' : This operator functions upon two operands and returns the difference between the two by subtracting the value of second operand from the first. Both the operands may have float or integer types.

For more information get help at CodeAvail- Online Computer Science Assignment
help

Answer Question

Anonymous