CodePudding user response:
While (nN++
}
CodePudding user response:
Sleep () functionCodePudding user response:
# include & lt; stdio.h>
# include & lt; Windows. H>
Int main (void)
{
Int nDelayTime=0;
While (1)
{
NDelayTime++;
If (nDelayTime==1000)
{
NDelayTime=0;
Printf (" hello world \ n ");
}
Sleep (1);
}
return 0;
}
Each time delay 1 ms, accumulate 1000 times, that is, 1 s, doing so will not affect other parts
CodePudding user response:
Certainly, you this is single threadedCodePudding user response:
Under Linux use sleep ()/usleep (); Under Windows can use the Sleep ()Pay attention to the parameters of meaning may be different, as some seconds, have a plenty of milliseconds