c++/c++ 공부한 것
변수의 종류
모든 것을 처음 시작하는 초짜 개발자
2023. 8. 6. 16:07
정수형
타입 | 할당 메모리 크기 | 표현범위 |
short | 2 Bytes | -32,768 ~ 32,767 |
unsigned short | 2 Bytes | 0 ~ 65,535 |
int | 2 Bytes | -2,147,483,648 ~ 2,147,483,647 |
unsigned int | 2 Bytes | 0 ~ 4,294,967,295 |
long | 4 Bytes | 2,147,483,648 ~ 2,147,483,647 |
unsigned long | 4 Bytes | 0 ~ 4,294,967,295 |
long long | 8 Bytes | –9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 |
unsigned long long | 8 Bytes | 0 ~ 18,446,744,073,709,551,615 |
실수형
타입 | 할당 메모리 크기 | 표현범위 |
float | 4 Bytes | 3.4E-38(-3.4*10^38) ~ 3.4E+38(3.4*10^38) (7digits) |
double | 8 Bytes | 1.79E-308(-1.79*10^308) ~ 1.79E+308(1.79*10^308) (15digits) |
문자형
타입 | 할당 메모리 크기 | 표현범위 |
char | 1 Bytes | -128 ~ 127 |
unsigned char | 1 Bytes | 0 ~ 255 |
wchar_t | 2 Bytes | 0 ~ 65,535 |
불(Bool) 형
타입 | 할당 메모리 크기 | 표현범위 |
bool | 1 Bytes | 0~1 |