fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define K 4
  4. #define W 4
  5.  
  6. void swap( int (**m)[K], const int w1, const int w2) {
  7.  
  8. int (*temp)[K] = m[w1];
  9. m[w1] = m[w2];
  10. m[w2] = temp;
  11.  
  12. }
  13.  
  14. int main( void ) {
  15.  
  16. int ( *m )[K] = { {3,5,1,4}, {0,0,0,0}, {9,9,1,9}, {0,0,0,0} };
  17.  
  18. swap( &m, 0, 2); //zamień wiersz 0 z 2
  19.  
  20. for( int i = 0; i < W; ++i ) {
  21.  
  22. for( int j = 0; j < K; ++j ) printf("%3d ", m[i][j]);
  23. puts("");
  24.  
  25. }
  26.  
  27. return 0;
  28.  
  29. }
Runtime error #stdin #stdout 0s 9296KB
stdin
Standard input is empty
stdout
Standard output is empty