[StudyNote C++ Primer] Compound Types

Variables and Basic Types

Section 2.1 Primitive Built-in Types

2.1.1 Arithmetic Types

include two categories: Integral types(character and boolean types) and floating-point types

char | character | 8bits
wchar_t | wide character | 16bits
char16_t | Unicode character | 16bits
char32_t
int 16bits
long 32bits
float 6 significant digits
double 10 significant digits

wchar_t char16_t char32_t etc are used for extended character sets

the integral types may be signed or unsigned

A signed type represents negative or positive numbers (including 0)

and an unsigned type represents only values greater than or equal to 0

In an unsigned type, all the bits represent the value
and 8-bit unsigned char can hold the values from 0 through 255 inclusive

2.1.3 Literals

the value 20 in three ways:
20 --- decimal

024 -- octal (begain with 0)

0x14 - hexadecimal (begin with 0x or 0X)

'a' --- character literal

"Hello World!" --- string literal

2.3 Compound Types

A compound type is a type that is defined in terms of another type.

two of which --- references and pointers

上一篇:C++primer 练习8.7和8.8


下一篇:C++ primer 中文版(第五版)第一章