continue Statement in C and C++ - how to jump to

<<Previous

Next >>





continue Statement in C and C++

  • continue statement in C and 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.

continue in c and c++ - Syntax

  continue;

continue Statement - 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.

continue Statement in C Example 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 >>




strcat() - String Concatenation        strcmp() - String Compare


strcpy() - String Copy        strlen() - String Length














continue Statement in C and C++ - how to jump to

<<Previous

Next >>





continue Statement in C and C++

  • continue statement in C and 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.

continue in c and c++ - Syntax

  continue;

continue Statement - 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.

continue Statement in C Example 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 >>






strncat() - String n Concatenation        strlwr() - String Lower       

strncmp() - String n Compare       strncpy() - String n Copy