Function sleep() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Function sleep()

How can I use the function sleep() from<time.h>to slow down the code below. Can anyone help me to fix it out? Thanks so much https://code.sololearn.com/cNBgj98LESYu/#c

3rd Oct 2018, 2:12 PM
Tuyen Pham
Tuyen Pham - avatar
3 Answers
+ 4
On SoloLearn, you will hit the timeout limit using sleep. Not to mention, it won't change anything as your output is only displayed after the program finishes. If your running it on your laptop, I'd put a sleep at the beginning of printPosition.
3rd Oct 2018, 3:17 PM
John Wells
John Wells - avatar
+ 2
... void printPosition( const int* const tortoisePtr, const int* const harePtr ){ sleep(1); // wait 1 second int i; ...
3rd Oct 2018, 3:21 PM
John Wells
John Wells - avatar
0
how can i put the sleep fuction at printPosition?
3rd Oct 2018, 3:18 PM
Tuyen Pham
Tuyen Pham - avatar