Data Types
| Data Type | C++ Keyword | Bits | Range |
|---|---|---|---|
| integer | int | 16 | -32768 to 32767 |
| long integer | long | 32 | -4294967296 to 4294967295 |
| short | short | 8 | -128 to 127 |
| unsigned integer | unsigned | 16 | 0 to 65535 |
| character | char | 8 | 0 to 255 |
| floating point | float | 32 | approximately 6 digits of precision |
| double floating point | double | 64 | approximately 12 digits of precision |
Constants
| Constant type | Examples |
|---|---|
| Integer Constants - Short integer - Integer -Unsigned integer - Long integer | -99 -35 0 45 127 -999 -1 0 555 32767 1 256 11000 59874 203 12 3345 8989898 |
| Character Constants | '$' '*' ' ' 'd' 'H' '1' |
| String Constants | "Name:" "Telephone No:" |
| Floating-piont Constants | 0.008 0.254E8 4.25E2 |
Operators
Arithmetic Operators
| Operator | Meaning |
|---|---|
| - | Subtraction (also unary minus) |
| + | Addition |
| * | Multiplication |
| ? | Division |
| % | Modulus division |
| -- | Decrement |
| ++ | Increment |
Relational Operators
| Operator | Meaning |
|---|---|
| < | Less than |
| <= | Less than or equal to |
| > | Greater than |
| >= | greater than or equal to |
| == | Equal |
| != | Not Equal |
Operator Precedence Hierarchy
| Operator Category | Operator |
|---|---|
| Unary | - -- ++ |
| Arithmetic multiply, divide, remainder | * / % |
| Arithmetic add and subtract | + - |
| Relational operators | < <= > >= |
| Equality operators | == != |
| Logical AND | && |
| Logical OR |
||
|

