ลักษณะ | ความหมาย |
---|---|
a += b | a = a + b |
a -= b | a = a - b |
a *= b | a = a * b |
a /= b | a = a / b |
a %= b | a = a % b |
a += b + 1 | a = a + b + 1 |
a -= b – 1 | a = a - b - 1 |
a *= b * 2 | a = a * b * 2 |
a /= b / 3 | a = a / b / 3 |
a %= b / 3 | a = a % b / 3 |
- Conditional statement :
expression 1 ? expression 2 : expression 3;
ถ้า expression 1 เป็นถูก ดังนั้น expression 2 จะทำงาน . แต่ถ้า expression 1 ผิด ดังนั้น expression 3 จะทำงาน
Operator | Description | Associativity |
---|---|---|
( ) [ ] . -> ++ -- | Parentheses (function call) Brackets (array subscript) Member selection via object name Member selection via pointer Postfix increment/decrement | left-to-right |
++ -- + - ! ~ (type) * & sizeof | Prefix increment/decrement Unary plus/minus Logical negation/bitwise complement Cast (convert value to temporary value of type) Dereference Address (of operand) Determine size in bytes on this implementation | right-to-left |
* / % | Multiplication/division/modulus | left-to-right |
+ - | Addition/subtraction | left-to-right |
<< >> | Bitwise shift left, Bitwise shift right | left-to-right |
< <= > >= | Relational less than/less than or equal to Relational greater than/greater than or equal to | left-to-right |
== != | Relational is equal to/is not equal to | left-to-right |
& | Bitwise AND | left-to-right |
^ | Bitwise exclusive OR | left-to-right |
| | Bitwise inclusive OR | left-to-right |
&& | Logical AND | left-to-right |
| | | Logical OR | left-to-right |
? : | Ternary conditional | right-to-left |
= += -= *= /= %= &= ^= |= <<= >>= | Assignment Addition/subtraction assignment Multiplication/division assignment Modulus/bitwise AND assignment Bitwise exclusive/inclusive OR assignment Bitwise shift left/right assignment | right-to-left |
, | Comma (separate expressions) | left-to-right |
No comments:
Post a Comment