# Thread: Unary operator and binary operator

1. Senior Member
Join Date
Aug 2013
Posts
108
Rep Power
0

## Unary operator and binary operator

Acc. to the definition a unary operator(+) operates on one operand.

1. int a=1+1;
2. int b=+a;

Now in the line 1 the + operator is used for two operands, while the line 2 operates on one operand. So how can + be called a unary operator or even binary operator, for that matter?

2. ## Re: Unary operator and binary operator

Those are two different operators that look the same (+); distinguishing between them is a little linguistic problem to be solved by the compiler (blame mathematics for it).

kind regards,

Jos

3. ## Re: Unary operator and binary operator

In programming, "+" is defined as the unary plus operator that makes an expression positive (however, numbers are positive without this), e.g int number = +1; however "+=" is assingment operator.

4. ## Re: Unary operator and binary operator

Originally Posted by allaudin
In programming, "+" is defined as the unary plus operator that makes an expression positive (however, numbers are positive without this), e.g int number = +1; however "+=" is assingment operator.
That was not what the OP was asking for and besides, the unary + operator doesn't make the value of the expression positive, e.g. int a= +-3; doesn't make a == 3; stop spewing your incorrect advice in these forums.

Jos

5. ## Re: Unary operator and binary operator

That was not what the OP was asking for and besides, the unary + operator doesn't make the value of the expression positive, e.g. int a= +-3; doesn't make a == 3; stop spewing your incorrect advice in these forums.

Jos
that was not my definiton ... Unary Operators and another Unary Operator - Definition for the Term: Unary Operator I already know you will say its wrong but not this time :P
Last edited by allaudin; 08-27-2013 at 03:30 PM.

6. ## Re: Unary operator and binary operator

Originally Posted by allaudin
that was not my definiton ... Unary Operators and another Unary Operator - Definition for the Term: Unary Operator I already know you will say its wrong but not this time :P
That Rose India site sucks big times; it should be taken off line.

Jos

7. ## Re: Unary operator and binary operator

Originally Posted by JosAH
That Rose India site sucks big times; it should be taken off line.

Jos
Full ack!

8. Just a guy
Join Date
Jun 2013
Location
Netherlands
Posts
2,612
Rep Power
3

## Re: Unary operator and binary operator

Originally Posted by PhHein
Full ack!
Ack ack.

9. ## Re: Unary operator and binary operator

Originally Posted by gimbal2
Originally Posted by PhHein
Full ack!
Ack ack.
Ack.

10. ## Re: Unary operator and binary operator

Originally Posted by allaudin
that was not my definiton ... Unary Operators and another Unary Operator - Definition for the Term: Unary Operator I already know you will say its wrong but not this time :P
See? It's not just me who detests that site; and you buntly posted it here as if it were the truth; it's far from it; I'm telling you for the last time (not asking it): stop posting all your nonsense in these forums. You are just a 'sheer beginner' (your own terminology) and not in a position to help out other posters. You merely ruin the threads. You'd better study first before you open your mouth again.

Jos

11. Senior Member
Join Date
Jan 2013
Location
United States
Posts
2,697
Rep Power
4

## Re: Unary operator and binary operator

Interesting! Looks like I got lucky when I chose this site. I haven't checked out Rose India. And looks like I probably won't.

Regards,
Jim

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•