RenHao

2-D array

Sep 20th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. //
  2. //  main.c
  3. //  test
  4. //
  5. //  Created by Ranhao on 2015/9/20.
  6. //  Copyright (c) 2015年 Ranhao. All rights reserved.
  7. //
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11.  
  12. void traverse(int m, int n, int A[m][n])
  13. {
  14.     int i,j;
  15.     for(i=0; i<m; i++)
  16.     {
  17.         for(j=0;j<n;j++)
  18.         {
  19.             printf("%d ",A[i][j]);
  20.         }
  21.         printf("\n");
  22.     }
  23. }
  24.  
  25. int main(int argc, const char * argv[])
  26. {
  27.     int A[2][3] =   {
  28.                     {1,2,3},
  29.                     {2,5,5}
  30.                     };
  31.     traverse(2,3,A);
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment