Raspberry C code getting stuck due to infinite for loop
Streams, to which functions like printf() write, by default exhibit line buffered behavior, and do not typically actually write the buffered output until either a line ending is encountered or an explicit fflush() is called.

Therefore, either change your message to include a newline:

printf("Hello world!\n");


Or explicitly flush the stream

printf("Hello world!");
fflush(stdout);


As this is really a generic programming question having nothing in particular to do with hardware or the Raspberry Pi, it would probably have better belonged on Stackoverflow - where it has no doubt been answered numerous times in the past.  Though it's quite understandable why the use of interrupts in an adjacent part of the code could be distracting, even though actually not relevant to the issue.