It is sometimes required to break from the inner loop of nested loops. In this a break statement can be used. However, the break statement will only exit from the nested inner loop in which it is encountered and control will be transferred to outer loop. In case we want to transfer control to some statement after the outer most nested loop, we can use goto statement. The code snippet below shows how to do that.
for (i=1; i<=10; i++)
for (j=1; j <=10; j++)
if ( i==j )
This code snippet transfers the control to the statement after the outermost loop when inside the innermost loop the value of i and j are same.