I was wondering the difference between puts() and printf() functions while using sleep() function.

Here is my code(In C language):

printf("hello, world");
sleep(1);
printf("Good, bye!");

After compiling and running the program, it seems that it will sleep first and then print "hello, worldGood, bye!"

However, if using puts() instead of printf(), it will print "hello, world" then sleep, and finally print "Good, bye".

puts("hello, world");
sleep(1);
puts("Good, bye!);
Edit
Report