Operators in C Language
| Description |
Operator |
Associativity |
| Elementary Operators |
() []->. |
-> |
| Single Object Operator |
! ~ ++ ---(Type) * & sizeof |
<- |
| Arithmetic Operators |
*/% |
-> |
| Arithmetic Operators |
+- |
-> |
| Shift Operator |
<> |
-> |
| Relational operators |
>>=< = |
-> |
| Relational operators |
=! = |
-> |
| Bitwise AND |
& |
-> |
| Bitwise OR |
^ |
-> |
| By bit or |
| |
-> |
| Logic and |
&& |
-> |
| Logic or |
| |
-> |
| Conditional Operators |
? : |
<- |
| Value assignment operator |
= + =-= * =/= % = <= >>=& = ^ = | = |
<- |
| Comma Operator |
, |
-> |
Operators in C ++
| Operator |
Description |
Associativity |
| :: |
Binary scope, unary Scope |
-> |
| () []. -> ++ -- typeid dynamic_cast static_cast reinterpret_cast const_cast |
elementary/type conversion ++ -- auto-increment after one dollar |
-> |
++ -- + -! ~ (Type) sizeof &* New [] delete Delete [] |
++ -- Auto-increment before one dollar |
<- |
| . *-> * |
Pointer to a member |
-> |
| */% |
Arithmetic Operators |
-> |
| +- |
Arithmetic Operators |
-> |
| <> |
Shift Operator |
-> |
| <=> = |
Relational operators |
-> |
| =! = |
Relational operators |
-> |
| & |
Bitwise AND |
-> |
| ^ |
Bitwise OR |
-> |
| | |
By bit or |
-> |
| && |
Logic and |
-> |
| | |
Logic or |
-> |
| ? : |
Conditional Operators |
<- |
| = + =-= * =/= % = <=> = |
Value assignment operator |
<- |
| , |
Comma Operator |
-> |
note: the priority decreases from top to bottom!
conclusion! (Please remember this sentence, though not quite satisfactory)
girls do not cry (QQ: 191035066) @ cnblogs @ 2011-12-29 11:01:10
http://www.cnblogs.com/nbsofer/archive/2011/12/29/2305766.html