Shares
print sharing button Print
twitter sharing button Tweet
facebook sharing button Share
whatsapp sharing button Share
pinterest sharing button Pin
email sharing button Email
mailru sharing button Share
googlebookmarks sharing button Mark
arrow_left sharing button
arrow_right sharing button

C and C++ break Statement - switch case break

<<Previous

Next >>





The break statement in C programming is used to branch out the switch case statement. It is also used to terminate the execution of loop statements such as for, while and do...while.

Syntax
  break;

break Statement inside while loop

while(expression)
{
	while(expression)
	{
		if (expression)
		break;
		statements
	}
	statements
}

Here the break will terminate the inner while-loop and proceed to execute the statements of the outer while-loop.

break Statement Example

#include<stdio.h>


int main()
{
  int a = 0;

  while(a <= 5)
  {
    if(a ==3)
     break;
    printf("The value of a = %d\n",a);
    a++ ;
  }

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

  return(0);

}

When you compile and execute the above program, you will get the following result.




<< Previous

Next >>




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


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














C and C++ break Statement - switch case break

<<Previous

Next >>





The break statement in C programming is used to branch out the switch case statement. It is also used to terminate the execution of loop statements such as for, while and do...while.

Syntax
  break;

break Statement inside while loop

while(expression)
{
	while(expression)
	{
		if (expression)
		break;
		statements
	}
	statements
}

Here the break will terminate the inner while-loop and proceed to execute the statements of the outer while-loop.

break Statement Example

#include<stdio.h>


int main()
{
  int a = 0;

  while(a <= 5)
  {
    if(a ==3)
     break;
    printf("The value of a = %d\n",a);
    a++ ;
  }

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

  return(0);

}

When you compile and execute the above program, you will get the following result.




<< Previous

Next >>






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

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