본문 바로가기
C,C++

Microsoft Visual C++ 프로그래밍 자료형 총정리

by matters_ 2018. 7. 23.
자료형크기범위비고
char 
signed char
1바이트, 8비트-128~127 
unsigned char1바이트, 8비트0~255 
short 
short int
2바이트, 16비트-32,768~32,767int 생략 가능
unsigned short 
unsigned short int
2바이트, 16비트0~65,535int 생략 가능
int
signed int
4바이트, 32비트-2,147,483,648~ 2,147,483,647 
unsigned 
unsigned int
4바이트, 32비트0~4,294,967,295int 생략 가능
long
long int
signed long
signed long int
4바이트, 32비트-2,147,483,648~ 2,147,483,647int 생략 가능
unsigned long 
unsigned long int
4바이트, 32비트0~4,294,967,295int 생략 가능
long long 
long long int 
signed long long 
signed long long int
8바이트, 64비트-9,223,372,036,854,775,808~
9,223,372,036,854,775,807
int 생략 가능
unsigned long long 
unsigned long long int
8바이트, 64비트0~18,446,744,073,709,551,615int 생략 가능



참고 | long

long은 운영체제와 플랫폼마다 크기가 다릅니다.

 표 7-2 운영체제 및 플랫폼별 long의 크기
운영체제CPU(플랫폼)바이트 크기비트 크기
Windowsx86(32비트)432
x86-64(64비트)432
리눅스x86(32비트)432
x86-64(64비트)864
OS Xx86(32비트)432
x86-64(64비트)864


Microsoft Visual C++의 자료형

Type NameBytesOther NamesRange of Values

int*signed, 
signed int

System dependent
unsigned int*unsignedSystem dependent

__int81char, 
signed char

–128 to 127
__int162short, 
short int, 
signed short int

–32,768 to 32,767
__int324signed, 
signed int

–2,147,483,648 to 2,147,483,647
__int648none–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

bool1none

false or true
char1signed char

–128 to 127
unsigned char1none

0 to 255
short2short int, 
signed short int

–32,768 to 32,767
unsigned short2unsigned short int

0 to 65,535
long4long int, 
signed long int

–2,147,483,648 to 2,147,483,647
long long8none 
(but equivalent to __int64)
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

unsigned long4unsigned long int0 to 4,294,967,295

enum*noneSame as int

float4none3.4E +/- 38 (7 digits)

double8none1.7E +/- 308 (15 digits)

long doublesame as doublenonesame as double

wchar_t2__wchar_t0 to 65,535

A variable of __wchar_t designates a wide-character or multibyte character type. 
By default wchar_t is a typedef for unsigned short.

 



출처 : https://dojang.io/mod/page/view.php?id=30

http://jyhpan.tistory.com/109

댓글