Question

when we put put delay, it will put a delay between doing the up line and down line or it will put a delay in doing all of the lines in our code?

int main()
{
  if ( kbhit() )
  {
   E = getCommand();
   doCommand(E);
   delay(100);
  }
}
Was it helpful?

Solution

There is no standard delay function, but many non-standard headers (like dos.h) and custom implementations are available in which it is used to suspend execution of a program for a particular time.

So, after executing doCommand(E), your program will wait for 100 milliseconds, i.e. it will pause for that time period, before executing further.

OTHER TIPS

There is no standard function called delay() in C. But it will very probably just insert a pause at the place where the function is called, that's a very common design.

Since the shown code doesn't loop or anything, it will just pause, then exit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top