fork download
  1. #include <stdio.h>
  2.  
  3. int Filter(short* array, short nNumRow, short nNumCol) {
  4. short arr[nNumRow][nNumCol];
  5. memcpy(arr, array, nNumRow * nNumCol * sizeof(short));
  6. for (int i = 0; i < nNumRow; i++) {
  7. printf("| ");
  8. for (int j = 0; j < nNumCol; j++) {
  9. printf("%d ", arr[i][j]);
  10. }
  11. printf("| \n");
  12. }
  13. return 0;
  14.  
  15. }
  16.  
  17. int main(void) {
  18. short arr[] = {1, 2, 3, 4, 5, 6 ,7, 8};
  19. Filter(arr, 2, 4);
  20. printf("---\n");
  21. Filter(arr, 4, 2);
  22. return 0;
  23. }
  24.  
  25.  
Success #stdin #stdout 0s 4292KB
stdin
Standard input is empty
stdout
| 1 2 3 4 | 
| 5 6 7 8 | 
---
| 1 2 | 
| 3 4 | 
| 5 6 | 
| 7 8 |