Here is my code:
#include <stdio.h>
#include <unistd.h>
int main() {
printf("hello");
sleep(1);
fflush(stdout);
printf("\rworld");
sleep(1);
fflush(stdout);
printf("\r! \n");
sleep(1);
return 0;
}
It displays "Hello" for a second, does nothing for another second, and then goes straight to "!" I have tried to change the sleep durations and a few other things but nothing has fixed it. What am I doing wrong?