內容
運算子 operators指定 Assignment
算術運算子 Arithmetic operators
關係運算子 Relational and equality operators
邏輯運算子 Logical operators
位元運算子 Bitwise Operators以二進位去做運算
移位運算子右移: 20 >> 1 → 00010100 >> 1 → 00001010 = 10 左移: 20 << 1 → 00010100 << 1 → 00101000 = 40 類型轉換 Explicit type casting operatorint i; float f = 3.14; i = (int) f; 也可以寫成
sizeof()回傳所佔用的位元組數 (bytes) a = sizeof (char); 複合指定運算子 Combination assignment operator
遞增及遞減運算子 Increase and decrease
條件運算子 Conditional operator ( ? )7==5 ? 4 : 3 //若7==5 return 4 否則return 3 運算子優先順序
|
C++ >