fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int m, n;
  5.  
  6. bool a[20][20];
  7. void print_arr() {
  8. for (int i = 0; i < m; i++) {
  9. for (int j = 0; j < n; j++){
  10. cout << a[i][j] << " ";
  11. }
  12. cout << endl;
  13. }
  14. }
  15.  
  16. int main() {
  17. cin >> m >> n;
  18.  
  19. for (int i = 0; i < m; i++) {
  20. for (int j = 0; j < n; j++) {
  21. a[i][j] = false;
  22. }
  23. }
  24.  
  25. print_arr();
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5300KB
stdin
4 5 
stdout
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0