【发布时间】:2018-10-16 07:14:31
【问题描述】:
我正在使用 1D 和 2D 数组,但我的 scanf 没有为我的 1D 数组循环迭代。这是我当前的代码:
#include <stdio.h>
int main(void)
{
int row, col, N, M;
printf("This program counts occurrences of digits 0 through 9 in an NxM array.\n");
printf("Enter the size of the array (Row Column): ");
scanf("%d%d", &N, &M);
int digits[N][M];
for (row = 0; row < N; row++){
printf("Enter row %d: ", row);
scanf("%d", digits[row][0]);
}
return 0;
}
【问题讨论】:
-
你用的是什么编译器?