CLion won't show output in Debug
Putting setbuf(stdout, 0);
before any printf statement or any output happens fixed this problem.
If you don't care to use the built-in clion console, you can solve the issue by changing the default debugger used by clion.
Under Settings => Toolchain => <your compiler> => Debugger
change Bundled GDB to your compiler's debugger, e.g. MinGW: