Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // 4 5 7 1
- // 5 9 6 5 -> 4 6 8 3 5 6 9 5 1 7 5 4
- // 3 8 6 4 23
- void matUNiz(int mat[10][10], int n, int m, int niz[], int* nizn) {
- *nizn = 0;
- for (int i = n-1; i >=0; i--)
- {
- for (int j = m-1; j >= 0; j--)
- {
- niz[*nizn] = mat[i][j];
- (*nizn)++;
- }
- }
- }
- int main(void) {
- int mat[10][10] = { {4,5,7,1},{5,9,6,5},{3,8,6,4} };
- int n = 3, m = 4;
- int niz[100];
- int nizn;
- matUNiz(mat, n, m, niz, &nizn);
- for (int i = 0; i < nizn; i++)
- {
- printf("%d\t", niz[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment