In Java, it is possible to escape from an outer loop using such a construct:
int[][] matrix;
int value;
...
outer: {
for(int i=0; i<n; i++)
for (int j=0; j<m; j++)
if (matrix[i][j] == value)
{
System.out.println("value " + value + " found in cell (" + i + "," + j + ")");
break outer; //HERE, or "continue outer;"
}
System.out.println("value " + value + " not found");
}
Are there any similar constructs in C (without ++)?
The thing is that my question was addressing a slightly different point, above I gave a simple example. What if I have 3 cycles (or more). And being in cycle 3, I need to interrupt cycle 2 at once, but without interrupting cycle 1. Can I write goto inside the loop?
for()//#1
for()//#2
for()//#3
{
// continue for()#1
}
Thanks, for the tips on how to create flags. I realize it can be done that way, but I was wondering if it is possible to do the same in C as in Java. To understand the capabilities of the C language. The program is just as an example.