Hello,
I have been trying to use the sleep function to get a short interuption in a C program, but is getting a bit of unexpected behaviour. If I for example type:
I get a one second interuption before the printf. I have been trying to use it in a small for loop as well in a countdown function with a one second interuption between each step, but with the same result. All interuptions in the loop is performed first and then all other steps is printed in one go.
Does anyone have any suggestion to why this might be?
I have been trying to use the sleep function to get a short interuption in a C program, but is getting a bit of unexpected behaviour. If I for example type:
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("3");
sleep (1);
return 0;
}
I get a one second interuption before the printf. I have been trying to use it in a small for loop as well in a countdown function with a one second interuption between each step, but with the same result. All interuptions in the loop is performed first and then all other steps is printed in one go.
Does anyone have any suggestion to why this might be?