1

advertisement
1
PRECEDENCE LEVEL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
OPERATOR NAME
Scope resolution (global scope)
Scope resolution (class scope)
Function Call
Type Construction
Array Subscripting
Component Selection
Indirect Component Selection
Address of
Cast
Compliment
Decrement
Delete
Increment
Indirection
Logical NOT
New
Size of type or object
Unary Plus
Unary Minus
Component pointer selection
Indirect component pointer
selection
Division
Modulus (Remainder)
Multiplication
Addition
Subtraction
Left Shift
Right Shift
Greater Than
Greater Than or Equal To
Less Than
Less Than or Equal To
Equal To
Not Equal To
Bitwise AND
Bitwise Exclusive OR
Bitwise Inclusive OR
Logical AND
Logical Inclusive OR
Conditional Operator
Assign AND
Assign Difference
Assign Division
Assign Exclusive OR
Assign Inclusive OR
Assign Left Shift
Assign Product
Assign Remainder
Assign Right Shift
Assign Sum
Simple Assignment
Comma
SYMBOL
ASSOCIATIVITY
::
::
()
()
[]
.
->
&
new
~
-(type)
++
*
!
delete
sizeof
+
.*
->*
->
<->
->
->
->
->
<<<<<<<<<<<<->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
<<<<<<<<<<<<->
/
%
*
+
<<
>>
>
>=
<
<=
==
!=
&
^
|
&&
||
?:
&=
-=
/=
^=
|=
<<=
*=
%=
>>=
+=
=
,
1
2
DATA REPRESENTATION
BASE
5
8
10
16
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
0
1
2
3
4
10
11
12
13
14
20
21
22
23
24
0
1
2
3
4
5
6
7
10
11
12
13
14
15
16
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
1111
30
17
15
F
10000
10001
10010
10011
10100
10101
10110
10111
11000
11001
11010
11011
11100
11101
11110
11111
100000
100001
100010
100011
100100
100101
100110
100111
31
32
33
34
40
41
42
43
44
100
101
102
103
104
110
111
112
113
114
120
121
122
123
124
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
40
41
42
43
44
45
46
47
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
20
21
22
23
24
25
26
27
2
POWER
8 7
6 5
256 128 64 32
HEX
SYMBOL
A-I
J-R
S-Z
0-9
SPACE
DIGIT
C
D
E
F
4
4
16
625
4096
10000
653536
3
8
125
512
1000
4096
2
4
25
64
100
256
1
2
5
8
10
16
0
1
1
1
1
1
BASE
2 0-1
5 0-4
8 0-7
10 0-9
16 0-F
HEX
NUMBER
1-9
1–9
2–9
0–9
0
2
3
ASCII
SYMBOL BIN HEX
ASCII
A
65
41 0100 0001
B
66
42 0100 0010
C
67
43 0100 0011
D
68
44 0100 0100
E
69
45 0100 0101
F
70
46 0100 0110
G
71
47 0100 0111
H
72
48 0100 1000
I
73
49 0100 1001
J
74
4A 0100 1010
K
75
4B 0100 1011
L
76
4C 0100 1100
M
77
4D 0100 1101
N
78
4E 0100 1110
O
79
4F 0100 1111
P
80
50 0101 0000
Q
81
51 0101 0001
R
82
52 0101 0010
S
83
53 0101 0011
T
84
54 0101 0100
U
85
55 0101 0101
V
86
56 0101 0110
W
87
57 0101 0111
X
88
58 0101 1000
Y
89
59 0101 1001
Z
90
5A 0101 1010
SPACE
32
20 0010 0000
0
48
30 0011 0000
1
49
31 0011 0001
2
50
32 0011 0010
3
51
33 0011 0011
4
52
34 0011 0100
5
53
35 0011 0101
6
54
36 0011 0110
7
55
37 0011 0111
8
56
38 0011 1000
9
57
39 0011 1001
EBCDIC
SYMBOL
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
SPACE
0
1
2
3
4
5
6
7
8
9
BIN
193
194
195
196
197
198
199
200
201
209
210
211
212
213
214
215
216
217
226
227
228
229
230
231
232
233
64
240
241
242
243
244
245
246
247
248
249
HEX
C1
C2
C3
C4
C5
C6
C7
C8
C9
D1
D2
D3
D4
D5
D6
D7
D8
D9
E2
E3
E4
E5
E6
E7
E8
E9
40
F0
F1
F2
F3
F4
F5
F6
F7
F8
F9
EBCDIC
1100 0001
1100 0010
1100 0011
1100 0100
1100 0101
1100 0110
1100 0111
1100 1000
1100 1001
1101 0001
1101 0010
1101 0011
1101 0100
1101 0101
1101 0110
1101 0111
1101 1000
1101 1001
1110 0010
1110 0011
1110 0100
1110 0101
1110 0110
1110 0111
1110 1000
1110 1001
0100 0000
1111 0000
1111 0001
1111 0010
1111 0011
1111 0100
1111 0101
1111 0110
1111 0111
1111 1000
1111 1001
3
4
C++ RESERVED WORDS
The following identifiers are reserved words in the C++ language and my not be used as
user-defined identifiers.
asm
auto
break
case
char
class
const
continue
default
delete
do
double
else
enum
extern
float
for
friend
goto
if
inline
int
long
new
operator
private
protected
public
register
return
short
signed
sizeof
static
strict
switch
this
typedef
union
unsigned
virtual
void
volatile
while
C ESCAPE SEQUENCES
ESCAPE
SEQUENCES
\a
\b
\f
\n
\r
\t
\v
\\
\’
\”
\?
\000
\xhhh
NAME
MEANING OF ESCAPE SEQUENCE
Alert
Backspace
formfeed
Newline
Carriaage Return
Horizontal Tab
Vertical Tab
Backslash
Single Quotation
Double Quote
Question Mark
Sounds a beep
Backs up one character
Starts a new screen or page
Moves to beginning of next line
Moves to beginning of current line
Moves to next tab position
Moves down a fixed amount
Prints a backslash
Prints a single quote mark
Prints a double quote mark
Prints a question mark
Prints a character whose ASCII code is a one to
three-digit octal value.
Prints a character whose ASCII code is a one to
three-digit hexadecimal value.
4
5
Basic C++ Variable Types
Keyword
Numerical Range
low
high
char
-128
127
int
-32,768
32,767
long
-2,147,483,648
2,147,483,647
float
3.4 x 10-38
3.4 x 1038
double
1.7 x 10-308
1.7 x 10308
-4932
long double
3.4 x 10
3.4 x 104932
Unsigned Integer Types
Keyword
Numerical Range
low
high
unsigned char
0
255
unsigned int
0
65535
unsigned long
0
232 - 1
Digits of
precision
n/a
n/a
n/a
7
15
19
Bytes of
memory
1
2
4
4
8
10
Bytes of memory
1
2
4
There are three integer types: char, int, and long; and three floating-point types:
float, double, and long double.
In theory, there is another integer type not shown here: short. In the MS-DOS environment, short
is identical to int, so it is seldom used. However, on some computer systems short is smaller than int.
5
Download