How can I sleep or pause the program excecution by a few seconds in C? I'm looking for something like this that is used in Java:

Thread.sleep(interval); 

Is possible do this using C ? Thanks in advance.

2 Answers

4
Omkar Guhilot On Best Solutions

There is an answer here: What is the proper #include for the function 'sleep' in C?

Be careful that it works differently in Unix and Windows, whereas in one is measured in millisecs and in the other in secs.

6
Daniel Muñoz Parsapoormoghadam On
#include <stdio.h>
#include <unistd.h>

int main (void){

    sleep(3);

    return 0;
}

Read more here.