Because the output is buffered. Most terminals will buffer the standard-output until either a newline (\n
) is encountered, or fflush(stdout)
is called.
Your loop that includes the call to delay
should eventually print the numbers, but when the program is finished.
Add fflush(stdout);
after the printf
-call to make the numbers appear immediately without newlines in between.