C++ Operators:
- Arithmetic
- Assignment
- comparison & logical operator
-Equality
-Relational
- Bitwise logical operators
-Ternary operators
-Comma operators
-Scope resolution operator
-New and delete
-Other operator
- Special operator
The arithmetic operators are called as binary operators
+,-,*,/,%,=
Table of Arithmetic operators
Comparision & logical operators:
a)Relational operators
<, >, <=, >=
b)Equality operators
==, !=
c)logical operators
&&,||,!
Bitwise logical operators:
Compound assignment operators:
Special Operator:
| Operator Name | syntax | Can overloading |
| Basic assignment | a=b | yes |
| Addition | a+b | Yes |
| Subtraction | a-b | Yes |
| Unary plus | +a | Yes |
| Unary minus | -a | Yes |
| Multiplication | a*b | Yes |
| Division | a/b | Yes |
| Module | a%b | Yes |
Comparision & logical operators:
a)Relational operators
<, >, <=, >=
b)Equality operators
==, !=
c)logical operators
&&,||,!
| Operator Name | syntax | Can overloading |
| Equal to | a==b | yes |
| Not equal to | a+b | Yes |
| Greater than | a-b | Yes |
| Less than | +a | Yes |
| Greater than or equal to | -a | Yes |
| less than or equal to | a*b | Yes |
| Logical negation | a/b | Yes |
| Logical AND | a%b | Yes |
| Logical OR | a||b | Yes |
Bitwise logical operators:
| Operator Name | syntax | Can overloading |
| Bitwise NOT | ~a | yes |
| Bitwise AND | a&b | Yes |
| Bitwise OR | a|b | Yes |
| Bitwise XOR | a^b | Yes |
| Bitwise left shift | a<<b | Yes |
| Bitwise Right shift | a>>b | Yes |
Compound assignment operators:
| Operator Name | syntax | Meaning | Can over loading |
| Addition assignment | a+=b | a=a+b | Yes |
| Subtraction assignment | a-=b | a=a-b | Yes |
| Multiplication assignment | a*=b | a=a*b | Yes |
| Division assignment | a/=b | a=a/b | Yes |
| Modula assignment | a%=b | a=a%b | Yes |
| Bitwise AND assignment | a&=b | a=a&b | yes |
| Bitwise OR assignment | a|=b | a=a|b | Yes |
| Bitwise XOR assignment | a^=b | a=a^b | Yes |
| Bitwise left shift assignment | a<<=b | a=a<<b | Yes |
| Bitwise Right shift assignment | a>>=b | a=a>>b | Yes |
Special Operator:
- Unary operators
- Ternary operators
- Comma Operators
- Scope resolution Operators
- New and delete Operators
- Other Operators
Unary Operator:
- * concern of the storage feild to which a pointer is pointing
- & ambrassion is a address of variable
- - negative value
- ! negation
- ~ Bitwise complemental
- ++incremental
- --decremental
- size of data type in bite.
Ternary Opetators
exp1; exp2; exp3;
(eg)
a b
max=(a>b)?<->;<->;
| ^ ^
V___________ |_____|
If (a>b)
max =a
else
max =b
Comma Operator:
A separator in the variable declaration
Scope resolution Operator:
Used in a class number function defenition
New and delete Operator:
Allocate and deallocated the memeory
Other Operator (or) paratheses:
For grouping expression
Membership Operator:(->):
Represent the variables in structure and union.
If (a>b)
max =a
else
max =b
Comma Operator:
A separator in the variable declaration
Scope resolution Operator:
Used in a class number function defenition
New and delete Operator:
Allocate and deallocated the memeory
Other Operator (or) paratheses:
For grouping expression
Membership Operator:(->):
Represent the variables in structure and union.
No comments:
Post a Comment