Table of Content

How to use Delay Function in c program ?



Program :

#include<stdio.h>
#include<stdlib.h>

main()
{
    printf("C program will exit in 20 seconds.");        

    delay(20000);                         

    return 0;
}

Output : Output displayed for 20 seconds

This c program will exit in 20 seconds.

Explanation :

void delay(unsigned int);

[arrowlist]

  • Delay function is used to suspend execution of a program for a particular time.
  • It requires Unsigned Integer as Parameter
  • Unsigned int is number in miliseconds
  • Note 1sec = 1000miliseconds
  • Header File : dos.h

[/arrowlist]