为什么C-Array在传递给函数时有一个错误的size of()值?
#include <stdio.h>void test(int arr[]) { int arrSize = (int)(sizeof(arr) / sizeof(arr[0])); printf("%d\n", arrSize); // 2 (wrong?!)}int main (int argc, const char * argv[]) { int point[3] = {50, 30, 12}; int arrSize = (int)(sizeof(point) / sizeof(point[0])); printf("%d\n", arrSize); // 3 (correct :-) ) test(point); return 0;}
ABOUTYOU
ibeautiful