데일리 codeup

C++ 자료형

hayo_su 2022. 7. 2. 22:11

너무 헷갈린다....

 

int , long -  4byte(32bits)

long long - 8byte(64bits)

float - 4byte(7digits)

double - 8byte(15digits) 요정도는 바로 쓸수있도록 하자~

 

문자형

(signed) char 1 byte -128 ~ 127
unsigned char 1 byte 0 ~ 255
wchar_t 2 byte 0 ~ 65,535

 

정수형

bool 1 byte 0 ~ 1
(signed) short (int) 2 byte -32,768 ~ 32,767  3만
unsigned short (int) 4 byte 0 ~ 65,535
(signed) int 4 byte -2,147,483,648 ~ 2,147,483,647  21억
unsigned int 4 byte 0 ~ 4,294,967,295
(signed) long (int) 4 byte -2,147,483,648 ~ 2,147,483,647
unsigned long (int) 4 byte 0 ~ 4,294,967,295
__int8 1 byte -128 ~ 127
__int16 2 byte -32,768 ~ 32,767
__int32 4 byte -2,147,483,648 ~ 2,147,483,647
__int64 8 byte -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807

 

실수형

 

float 4 byte 3.4E-38(-3.4*10^38) ~ 3.4E+38(3.4*10^38) (7digits)
(long) double 8 byte 1.79E-308(-1.79*10^308) ~ 1.79E+308(1.79*10^308) (15digits)