Pages

Saturday, 23 April 2016

Delay Function

In code block you can use 

Sleep(unsigned int miliseconds);
function for delay in execution.
delay(unsigned int miliseconds) function is used in turbo c. For codeblocks you have to add code which is given below example:
#include<stdio.h>
#include<time.h>
void delay(unsigned int mseconds){
    clock_t goal = mseconds + clock();
    while (goal > clock());
}
int main(){
    int i;
    for(i=0;i<10;i++){
        delay(1000);
        printf("This is delay function\n");
    }
    return 0;
}

No comments:

Post a Comment