C

C언어 데이터 타입 크기

볼봇 2016. 7. 9. 10:57

#include<stdio.h>


void main() {

printf("long : %dByte\n", sizeof(long));

printf("double : %dByte\n", sizeof(double));

printf("int : %dByte\n", sizeof(int));

printf("char : %dByte\n", sizeof(char));

}



long : 4Byte

double : 8Byte

int : 4Byte

char : 1Byte



sizeof(데이터타입) 을 통해 변수의 데이터 크기를 확인할 수 있습니다.