我正在为类编写一个程序,要求用户输入二维数组的大小,然后让用户输入数组的值.这是我到目前为止的代码:
#include <stdio.h>
int main(void)
{
// Setup
int N, M;
int row = 0, col = 0;
printf("\n");
printf("This program counts occurences 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 array[N][M];
// Array Input
for (row = 0; row < N; row++)
{
printf("Enter row %d: ", row);
for (col = 0; col < M; col++);
{
scanf(" %d", &array[row][col]);
}
}
printf("\n"); …Run Code Online (Sandbox Code Playgroud)