#include <iostream> using namespace std; int main() { char a[5][5]; int j = 0; for(int i = 0; i < 4; i++) { while(j<4) { if(ji >= 0) { a[i][j] = '1'; j++; } else a[i][j] = ' '; j++; } j = 0; } j = 0; for(int i = 0; i < 4; i++) { while(j<4) { cout << a[i][j]; j++; } j = 0; cout << "\n"; } return 0; } 

The code prints nothing and does not return, I suspect that it is stuck in a loop, but I can not find where.

  • four
    Do not your eyes hurt to look at this formatting? And why aren't you using a debugger? - VladD
  • clion does not issue errors. - player1
  • 2
    Debugger, not a compiler. - VladD

1 answer 1

Tell me, what will be in the first while at the second iteration, when i=1 , and j is 0?

All clear? :)

  • Thank you, kind man, truly a silly mistake :) - player1