ET의 공부/C언어
[C언어] 변수의 크기를 찾는 프로그램
이티의 골방
2020. 12. 12. 21:38
C언어로 변수의 크기를 찾는 프로그램입니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include<stdio.h>
int main() {
int intType;
float floatType;
double doubleType;
char charType;
printf("int의 크기: %zu bytes\n", sizeof(intType));
printf("float의 크기: %zu bytes\n", sizeof(floatType));
printf("double의 크기: %zu bytes\n", sizeof(doubleType));
printf("char의 크기: %zu byte\n", sizeof(charType));
return 0;
}
|

sizeof(변수)는 데이터의 크기를 반환합니다.