P>

Answer: No, continue statement works inside loops only.

Listed below are two examples of continue statement. Both examples show how to skip "Detail print....." in the next statements with the continue statement. They take keyboard inputs from user and if user presses the ESC key, they then skip the remaining statements like a long print and continue to the next iteration.
Example:

for(i = 0; i < 10; i++)
{
  printf("Iteration %d\nPress Esc to skip long print", i);
  if(getch() == 27)/*Esc pressed*/
  {
    continue;
  }
  printf("Detail print....");
}
i = 0;
while(i < 10)
{
  printf("Iteration %d\nPress Esc to skip long print", i);
  i++;
  if(getch() == 27)/*Esc pressed*/
  {
    continue;
  }
  printf("Detail print....");
  
}

About our authors: Team EQA

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

#