Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //КАК Передать в функцию столбец/строку двумерного массива для манипуляций
- #include <stdio.h>
- #define SIZE 5
- void pop_arr(int s,int a[s][s]);
- void pr_arr(int s,int a[s][s]);
- //void sort_row(int s,int a[s][s],row);
- void sort_row(int s,int a[k]);
- int main()
- {
- 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};
- pop_arr(SIZE,a);
- pr_arr(SIZE,a);
- //sort_row(SIZE,a,3);
- sort_row(SIZE,a[3]);
- return 0;
- }
- void pop_arr(int s,int a[s][s])
- {
- int i,j;
- for(i=0;i<s;i++)
- {
- for(j=0;j<s;j++)
- a[i][j]= rand()%10;
- }
- }
- void pr_arr(int s,int a[s][s])
- {
- int i,j;
- for(i=0;i<s;i++)
- {
- for(j=0;j<s;j++)
- printf("%d\t",a[i][j]);
- printf("\n");
- }
- }
- void sort_row(int s,int a[k])
- {
- int i,j;
- for(j=0;j<s;j++)
- {
- //swaps a[k][i] with a[k][s-i-1]
- temp = a[j];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement