Header Files Used

For the Windows platform, we can include windows.h library.

#include<windows.h>

For the Linux platform, we can use unistd.h standard library. We can include this library as shown below 

#include<unistd.h>

sleep() Function in C

sleep() function in C allows the users to wait for a current thread for a specific time. Other operations of the CPU will function properly but the sleep() function will sleep the present executable for the specified time by the thread.

Similar Reads

Header Files Used

For the Windows platform, we can include windows.h library....

Parameter

For Linux systems, the sleep function takes a number of seconds you want the users to wait....

Return Value

The sleep() function in C returns 0 if the requested time has elapsed. Due to signal transmission sleep() returns the unslept quantity, a difference between the requested time to sleep()  and the time it actually slept in seconds....

Examples of sleep() Function in C

Example 1: For Linux...

Contact Us