Hi,
Binary means having two operands for doing the operation
while unary have only one operand to do any operation.
suppose you have the following code for binary operation
int result =0 , op1 = 3, op2= 4;
result = op1 + op2;
// the value of result will be 7 because '+' is a binary operator
// 'op1' and 'op2' are the two operands
while in the case of unary operator
int op1 = 10;
op1++;
// now the value of op1 is 11, because '++' is a unary operator
// it involves only one operator, it adds a 1 to the 'op1' and put
// that result back into 'op1'
Last edited by emarshah; Jun 26th, 2009 at 4:59 pm.
Reputation Points: 10
Solved Threads: 6
Junior Poster in Training
Offline 61 posts
since Jan 2008