Advertisement
Lisaveta777

КАК?

Dec 4th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. //КАК Передать в функцию столбец/строку двумерного массива для манипуляций
  2.  
  3. #include <stdio.h>
  4. #define SIZE 5
  5.  
  6. void pop_arr(int s,int a[s][s]);
  7. void pr_arr(int s,int a[s][s]);
  8. //void sort_row(int s,int a[s][s],row);
  9. void sort_row(int s,int a[k]);
  10.  
  11. int main()
  12. {
  13.     int i,j,k,a[SIZE][SIZE];//{2,4,6,8,0,5,7,3,9,1};//{8,2,5,9,1,3,7,5,3,4};
  14.     pop_arr(SIZE,a);
  15.     pr_arr(SIZE,a);
  16.     //sort_row(SIZE,a,3);
  17.     sort_row(SIZE,a[3]);
  18.     return 0;
  19. }
  20. void pop_arr(int s,int a[s][s])
  21. {
  22.     int i,j;
  23.     for(i=0;i<s;i++)
  24.     {
  25.         for(j=0;j<s;j++)
  26.         a[i][j]= rand()%10;
  27.     }
  28. }
  29. void pr_arr(int s,int a[s][s])
  30. {
  31.     int i,j;
  32.     for(i=0;i<s;i++)
  33.     {
  34.         for(j=0;j<s;j++)
  35.         printf("%d\t",a[i][j]);
  36.         printf("\n");
  37.     }
  38. }
  39. void sort_row(int s,int a[k])
  40. {
  41.     int i,j;
  42.     for(j=0;j<s;j++)
  43.     {
  44.         //swaps a[k][i] with a[k][s-i-1]
  45.         temp = a[j];
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement