Understanding the Break Statement in C

break statement in c is used to come out of loop and to come out of switch block. break is also used in conjunction with functions and case statements.

Program to understand using break inside loop.

void main()
  int i=1;
      if(i>5); break; /* if i value is 6 terminate */
  }while(1);  /* this is infinite loop */


1 2 3 4 5
Naveed Tawargeri

Hi, I'm Naveed Tawargeri, and I'm the owner and creator of this blog. I'm a Software Developer with a passion for Programming.