-
Notifications
You must be signed in to change notification settings - Fork 246
/
2.5.cpp
28 lines (24 loc) · 956 Bytes
/
2.5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
int main() {
// (a)
'a'; // character literal, type is `char`
L'a'; // wide character literal, type is `wchar_t`
"a"; // character string literal
L"a"; // wide character string literal
// (b)
10; // integral literal, type is `int`
10u; // unsigned integral literal, type is `unsigned int`
10L; // integral literal, type is `long int`
10uL; // unsigned integral literal, type is `unsigned long int`
012; // octal integral literal, type is `int`
0xC; // hexadecimal integral literal, type is `int`
// (c)
3.14; // floating-point literal, type is `double`
3.14f; // floating-point literal, type is `float`
3.14L; // floating-point literal, type is `long double`
// (d)
10; // integral literal, type is `int`
10u; // unsigned integral literal, type is `unsigned int`
10.; // floating-point literal, type is `double`
10e-2; // floating-point literal, type is `double`
return 0;
}