📜  如何在 c 中扫描二维数组 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:34.082000             🧑  作者: Mango

代码示例1
#include 
#include 

int main (int argc, char* arv[]){

  int target;               // for later processing, irrelevant here
  int m;                    // m = #rows and #columns of array
  int array[m][m];
  scanf("%d %d", &target, &m);
 
  int i, k;
  for(i = 0; i < m; i++){
    for(k = 0; k < m; k++){
       scanf("%d", &(array[i][k]));    // save value in array.
    }
  }
                                      // the problem occurs before this point.
  for(i = 0; i < m; i++){
     for(k = 0; k < m; k++){
       printf("%2d", array[i][k]);    // print array.
     }
     printf("\n");
  }  

  return 0;
}