Break Statement - C Tutorial

Break Statement

break is jump statement used to terminate a switch or loop on some desired condition. On execution, it immediately transfer program control outside the body of loop or switch.

How break statement works?

Break Statement

Break Statement - Example

 #include <stdio.h>
int main()
{
	int i;
	for(i=1;i<=10;i++)
	{
		if(i==5)
			break;
		printf("%d\n",i);
	}
    return 0;
}
Output
1
2
3
4