Program to cause 1 sec delay in C and than print stuff

In the absense of any other information in your question…

You should find a sleep function in nearly any C environment (note that it’s all lower case). It’s usually in time.h or unistd.h, and accepts the number of seconds that it should delay execution.

Many environments will also have nanosleep, which is an equivalent that accepts a number of nanoseconds rather than seconds. Also in time.h on many systems.

Bottom-line is that your C environment is likely to provide such a function, whether it’s sleep, _sleep, Sleep, or something else similar, and whether it accepts seconds, nanoseconds, or milliseconds. You’ll have to refer to the documentation for your environment to find the specific one.

Leave a Comment