C Continue Statement

<<Previous

Next >>





continue Statement

  • continue statement in C programming is used to skip the current iteration and continue with the next iteration.
  • continue statement operates on loops only
  • it does not operate on switch.

Syntax

  continue;

Significance in Loops

  • In while and do..while loop, continue causes the program control to jump to the conditional expression, which is reevaluated for the next iteration.
  • In case of for loop, it causes the loop to first execute the increment and then cause the program control to transfer to the conditional expression which is reevaluated for next iteration.

Example C Program

#include<stdio.h>


int main()
{
  int a;
  for(a = 0 ; a<5 ; a++)
  {
    if(a == 3)
    continue;
    printf("The value of a = %d\n",a);
  }

  printf("The final value of a = %d\n",a);

  return(0);

}

Output

When you compile and execute the above program, you will get the following output:



<< Previous

Next >>







C Continue Statement

<<Previous

Next >>





continue Statement

  • continue statement in C programming is used to skip the current iteration and continue with the next iteration.
  • continue statement operates on loops only
  • it does not operate on switch.

Syntax

  continue;

Significance in Loops

  • In while and do..while loop, continue causes the program control to jump to the conditional expression, which is reevaluated for the next iteration.
  • In case of for loop, it causes the loop to first execute the increment and then cause the program control to transfer to the conditional expression which is reevaluated for next iteration.

Example C Program

#include<stdio.h>


int main()
{
  int a;
  for(a = 0 ; a<5 ; a++)
  {
    if(a == 3)
    continue;
    printf("The value of a = %d\n",a);
  }

  printf("The final value of a = %d\n",a);

  return(0);

}

Output

When you compile and execute the above program, you will get the following output:



<< Previous

Next >>







Learn about Hashing and Hash table

Learn Expression Tree

OS Kernel Architecture

OS Arcitecture of Windows, Linux and MacOS

Learn OS scheduling Algorithms