본문 바로가기

c++/c++ 공부한 것

변수의 종류

정수형

타입 할당 메모리 크기 표현범위
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

 

'c++ > c++ 공부한 것' 카테고리의 다른 글

If, for, while, continue, break  (0) 2023.08.06
자료형(char, int, double, bool, string)  (0) 2023.08.06
상수, 코멘트, 사칙연산  (0) 2023.08.06
hello world, 입력 받기  (0) 2023.08.06