Breaking out of nested loops in C++ -



Breaking out of nested loops in C++ -

this question has reply here:

can utilize break exit multiple nested loops? 14 answers

say have next code , when break want break out of inner , outer loop instead of inner loop , go straight blablabla. how can in c++?

for (int = 0; < m; i++) { (int j = 0; j < n; j++) { if (some condition) { // , break... break; // breaks out of inner loop } } } blablabla ...

"go straight [...]" sound perfect job goto. , !

for (int = 0; < m; i++) { (int j = 0; j < n; j++) { if (some condition) { // , break... goto afterloop; // breaks out of both loops } } } afterloop: // more stuff

c++ for-loop

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -