Class 3 || How to Declare and Initialize the Variables in C++ || C++ tutorial || Easy and Simple

preview_player
Показать описание
Basic Data Types

The data type specifies the size and type of information the variable will store:

Data Type Size Description
int 4 bytes Stores whole numbers, without decimals
float 4 bytes Stores fractional numbers, containing one or more decimals. Sufficient for storing 7 decimal digits
double 8 bytes Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits
boolean 1 byte Stores true or false values
char 1 byte Stores a single character/letter/number, or ASCII values

Type Keyword
Boolean bool
Character char
Integer int
Floating point float
Double floating point double
Valueless void
Wide character wchar_t

Type Typical Bit Width Typical Range
char 1byte -127 to 127 or 0 to 255
unsigned char 1byte 0 to 255
signed char 1byte -127 to 127
int 4bytes -2147483648 to 2147483647
unsigned int 4bytes 0 to 4294967295
signed int 4bytes -2147483648 to 2147483647
short int 2bytes -32768 to 32767
unsigned short int 2bytes 0 to 65,535
signed short int 2bytes -32768 to 32767
long int 8bytes -2,147,483,648 to 2,147,483,647
signed long int 8bytes same as long int
unsigned long int 8bytes 0 to 18,446,744,073,709,551,615
long long int 8bytes -(2^63) to (2^63)-1
unsigned long long int 8bytes 0 to 18,446,744,073,709,551,615
float 4bytes
double 8bytes
long double 12bytes
wchar_t 2 or 4 bytes 1 wide character
Рекомендации по теме