标签: c arrays dynamic-memory-allocation
为什么当我们使用动态大小的数组而不是将数组的大小作为变量时,为什么要使用指针和malloc / calloc?
int *array = (int*)malloc(sizeof(int) * (n)); for (int i = 0; i < n; i++ ) array[i] = 1; // What are their differences? int array[n]; for (int i = 0; i < n; i++ ) array[i] = 1;