반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sizeof : 자료형의 공간 크기(메모리 사이즈)를 알아내기 | |
가령 | |
int a에서 자료형 | |
1) int는 4byte의 공간을 갖고 있다. | |
2) 값은 1개를 넣을수 있다. ( a = 1) | |
int b[100]는 | |
1) 100개의 값을 넣을수 있고 | |
2) 각각 4byte의 공간을 갖는다..-> b[0] : 4byte, b[1] :4byte...... | |
따라서 100개 x 4byte = 400 byte의 공간을 갖는다. | |
all right | |
:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() | |
{ | |
int a; | |
printf("\nint a 공간 사이즈(sizeof) ? %d byte ", sizeof(a)); | |
int b[100]; | |
printf("\nint b[100] 공간 사이즈(sizeof) ? %d byte ", sizeof(b)); | |
} | |

반응형