I can't find a viable guide so I am asking how do I delay a function in C, in other words, how do I make a program wait a certain number of seconds before continuing to execute other functions?
For example:
printf("First Function.\n");
//program waits a certain number of seconds before executing next command
printf("Second function executed after certain amount of seconds");
I want to know, what is the command I use to make this happen?
delay();
for me doesn't work by the way.
I must add, sleep()
doesn't work either.
sleep
is what you’re looking for.
printf("First Function.\n");
sleep(20); // Replace 20 with the "certain amount"
printf("Second function executed after certain amount of seconds")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With