Data Type 크기 및 범위

2018. 5. 11. 18:02IT-개발/C및C++

반응형


현재 내 PC Data Size(몇 바이트)를 알고, Data 의 최대, 최소 값을 알고 사용합시다.


(Data 크기보기 소스)

#include <iostream>

using namespace std;

 

cout << "Size of int : " << sizeof(int) << " byte" << endl;

cout << "Size of unsigned int : " << sizeof(unsigned int) << " bytes" << endl;

cout << "Size of __int8 : " << sizeof(__int8) << " bytes" << endl;

cout << "Size of unsigned __int8 : " << sizeof(unsigned __int8) << " bytes" << endl;

cout << "Size of __int16 : " << sizeof(__int16) << " bytes" << endl;

cout << "Size of unsigned __int16 : " << sizeof(unsigned __int16) << " bytes" << endl;

cout << "Size of __int32 : " << sizeof(__int32) << " bytes" << endl;

cout << "Size of unsigned __int32 : " << sizeof(unsigned __int32) << " bytes" << endl;

cout << "Size of __int64 : " << sizeof(__int64) << " bytes" <<endl;

cout << "Size of unsigned __int64 : " << sizeof(unsigned __int64) << " bytes" << endl;

cout << "Size of bool : " << sizeof(bool) << " bytes" <<endl;

 

cout << "Size of char : " << sizeof(char) << " bytes" <<endl;

cout << "Size of signed char : " << sizeof(signed char) << " bytes" <<endl;

cout << "Size of unsigned char : " << sizeof(unsigned char) << " bytes" <<endl;

cout << "Size of short : " << sizeof(short) << " bytes" <<endl;

cout << "Size of unsigned short       : " << sizeof(unsigned short) << " bytes" <<endl;

cout << "Size of long : " << sizeof(long) << " bytes" <<endl;

cout << "Size of unsigned long : " << sizeof(unsigned long) << " bytes" <<endl;

 

cout << "Size of long long : " << sizeof(long long) << " bytes" <<endl;

cout << "Size of unsigned long long : " << sizeof(unsigned long long) << " bytes" <<endl;

cout << "Size of enum : " << sizeof(enum edata) << " bytes" <<endl;

cout << "Size of float : " << sizeof(float) << " bytes" <<endl;

cout << "Size of double : " << sizeof(double) << " bytes" <<endl;

cout << "Size of long double : " << sizeof(long double) << " bytes" <<endl;

cout << "Size of wchar_t : " << sizeof(wchar_t) << " bytes" <<endl;


(Data 범위보기 소스)

.... 작업중... ㅠㅠ 


//////////////////////////////////////////////////////////////////



msdn Link 입니다.

https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx






출처 : https://msdn.microsoft.com/en-us/library/7fh3a000.aspx









'IT-개발 > C및C++' 카테고리의 다른 글

for 문 ~  (0) 2019.03.12
동작 시간 계산 방법 (1)  (0) 2018.12.28
C++11 - sample - array(1)  (0) 2018.04.18
[펌] C/ C++ 전처리 - #if #else #elif #endif 등등...  (0) 2017.05.17
format 숫자 출력하기  (0) 2017.05.11