C++11 C++ The C++11 standard defines basic data types, including arithmetic types (arithmetic type) and empty types (void); arithmetic types include characters, integers, boolean values, and floating point numbers. The empty type does not correspond to specific values and is only used in special cases. For example, the most common use is to use the empty type (void) as the return type when the function does not return any value.
Types | Meaning | The smallest size |
---|---|---|
bool | Type of Bull | undefined, only true and false |
char | Character types | 8bit |
wchar_t | Wide characters | 16bit |
char16_t | Unicode characters | 16bit |
char32_t | Unicode characters | 32bit |
short | Short whole | 16bit |
int | Whole type | 16bit |
long | Full length | 32bit |
long long | Full length | 64bit |
float | Single-precision floating point type | 6 valid digits |
double | Double-precision floating point | 10 valid digits |
long double | Extended precision floating point type | 10 valid digits |
Data is stored internally in a sequence of bits, each bit not 0 or 1. Most computers process memory as a block with 2 integers of bits per bit, the smallest addressing memory block is called a byte byte, 1 byte on most machines is 8 bits, the basic unit of storage is called a byte byte (Word), and the word is 32 or 64 bits, which is 4 or 8 bytes. Most computers associate each byte in memory with a number (called an address address).
In addition to the bull and extended character types, other integers can be divided into signed and unsigned. Signed int can represent positive, negative, and 0 unsigned int simply indicates a value greater than or equal to 0. By default, the types int, short, long, and long long are whole types with symbols, and the prefix unsigned in front of each of them gives a type without symbols.
The char type is divided into three types: char, signed char, and unsigned char. It should be noted that char is not the same as signed char, and the specific char representation is only one of two (with and without symbols), which is decided by the compiler.