This is an old revision of the document!
다음은 추가 라이브러리 필요없이 바로 쓸 수 있는 자료형이다. 각 자료형의 크기는 64bit ubuntu 20.04 LTS 버전의 g++ 9.3.0버전 기준으로 작성되었다. 자료형마다 할당되는 크기는 OS와 컴파일러에 따라 차이가 있을 수 있다.
자료 유형 구분 | 자료형 | 크기 | 범위 | 비고 |
---|---|---|---|---|
자료 유형 없음 | void | - | - | - |
정수형 | bool | 1 byte | 1 or 0 | true or false |
char(int8_t) | 1 byte | $-2^7 \sim 2^7-1$ | - | |
unsigned char(uint8_t) | 1 byte | $0 \sim 2^8-1$ | - | |
short(int16_t) | 2 byte | $-2^{15} \sim 2^{15}-1$ | - | |
unsigned short(uint16_t) | 2 byte | $0 \sim 2^{16}-1$ | - | |
int(int32_t) | 4 byte | $-2^{31} \sim 2^{31}-1$ | - | |
unsigned int(uint32_t) | 4 byte | $0 \sim 2^{32}-1$ | - | |
long(long int, long long, long long int, int64_t) | 8 byte | $-2^{63} \sim 2^{63} -1$ | - | |
unsigned long(unsigned long int, unsigned long long, unsigned long long int, uint64_t) | 8 byte | $ 0 \sim 2^{64}-1$ | - | |
실수형 | float | 4 byte | $-3.4 \times 10^{-38} \sim 3.4 \times 10^{38}$ | 최대 정확도: 소수점 아래 7자리 |
double | 8 byte |