Is there an alternative for sleep() in C?

后端 未结 16 1980
无人及你
无人及你 2020-12-02 14:55

In traditional embedded programming, we will give a delay function like so:

for(i=0;i<255;i++)
   for(j=0;j<255;j++);

In the micropro

16条回答
  •  情书的邮戳
    2020-12-02 15:16

    I found the function in this post (http://cboard.cprogramming.com/c-programming/111229-how-use-sleep-function.html) and it works:

    #include 
    #include 
    
    int main()
    {
        puts("Hello \n");
        /* in windows.h is declared the Sleep (upper S) function and it takes time in 
    miliseconds */
        Sleep(3000);
        puts("World \n");
        return 0;
    }
    

提交回复
热议问题