#include<stdio.h>
#include<stdlib.h>
int main (int argc, char *argv[]) {
int* arr1 = (int*)malloc(sizeof(int)*4);
int arr2[4];
printf("%d \n", sizeof(arr1));
printf("%d \n", sizeof(arr2));
free(arr1);
return 0;
}
출력왜 malloc 화 배열과 비 malloc 배열의 크기가 다른가요?
8
16
이유는 무엇입니까?
첫 번째 포인터 : sizeof 포인터. 두 번째 : sizeof 배열 .... – LPs
아마도 더 나은 중복 : http://stackoverflow.com/questions/492384/how-to-find-the-sizeofa-pointer-pointing-to-an-array – Lundin
Ludin @ it 's about 더미. –