Home Page | |

Index | |

All Pages |

Create a new Page | |

Administration | |

File Management | |

Login/Logout | |

Your Profile |

Software |

Name | Syntax | Return Value |
---|---|---|

Increment | `++A` | `A + 1` |

`A++` | `A` | |

Decrement | `––A` | `A - 1` |

`A--` | `A` |

Name | Syntax | Assignment Shortcut |
---|---|---|

Arithmetic | `A + B` | Yes |

Modulo (remainder) | `A % B` | Yes |

Logical AND, OR, NOT | `A && B` | No |

Bitwise AND, OR, NOT, XOR | `A & B` | Yes |

Bit Shift Left, Right | `num << n ` | Yes |

Comparison | `A < B` | No |

- For those operators which permit assignment shortcuts, the syntax*Assignment Shortcuts*`LHS op= RHS`

is equivalent to`LHS = LHS op RHS`

. For example, the following two statements are equivalent:`A += 5`

and`A = A + 5`

- When shifting bits left, zeros are padded on the right. When shifting bits right, the left-most bit is a sign bit, and is propagated to the right.*Bit Shifts*

- To swap integer values without using an intermediate variable, use the following code:*Swapping integer values*`a ^= b; b ^= a; a ^= b;`

.

Name | Syntax |
---|---|

Conditional | |

Operators | Usage | Associativity |
---|---|---|

`::` | Scope Resolution | Left |

`() [] -> .` | Left | |

`! ~ +` (unary) `-` (unary) `++ –– &` (unary) | Logical NOT; Bitwise NOT; Arithmetic sign; Increment; Decrement; AddressOf | Right |

* (unary) `(typecast) static_cast` | Pointer dereferencing; casting | Right |

`const_cast dynamic_cast reinterpret_cast` | Casting | Right |

`sizeof new delete...typeid` | Right | |

`.*` (unary) `->*` | Left | |

`* / %` | Arithmetic | Left |

`+ -` | Arithmetic | Left |

`<< >>` | Bitwise shift | Left |

`< <= > >=` | Logical Comparison | Left |

`== !=` | Logical Comparison | Left |

`&` | Bitwise logic | Left |

`^` | Bitwise logic | Left |

`|` | Bitwise logic | Left |

`&&` | Boolean Logic | Left |

`||` | Boolean Logic | Left |

`?:` | Conditional operator | Right |

`= *= /= %= += -=` | Assigment; Assignment shortcuts | Right |

`&= ^= |= <<= >>=` | Assignment shortcuts | Right |

`,` (comma) | Multiple statements | Left |