| | |
Continuing from one loop into the other?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
Hi guys,
I've got two loops, and I want to be able to continue; the outermost loop when the innermost loop finds something. How would I do that?
TIA,
Clockowl
I've got two loops, and I want to be able to continue; the outermost loop when the innermost loop finds something. How would I do that?
c Syntax (Toggle Plain Text)
//(...) for (n = startStorage; n < quadcount; n++) { if (!notOptimized(n, optimized)) continue; int *x = &quadindex[n*4]; for (eachX = 0; eachX < 4; eachX++) { if(facesPerVert[x[eachX]] > 4) continue n-loop, not eachX-loop!; //(...)
TIA,
Clockowl
break from the inner loop and then continue from the outer loop. If there's more to the body, you may need a flag or something similar:
c Syntax (Toggle Plain Text)
while (condition) { int nextIteration = 0; while (condition) { if (condition) { nextIteration = 1; break; } } if (nextIteration) continue; ... }
If at first you don't succeed, keep on sucking until you do succeed.
![]() |
Similar Threads
- Booting computer freezes, and in a giant loop (Windows NT / 2000 / XP)
- Removing elements from a list in a loop (Python)
- Word count (C)
- Need help with do while loop (Java)
- Help Me Solve My Infinite Loop (C++)
- A Small Problem ....plz Help Me Out.... (C)
- Single brace use? (C++)
Other Threads in the C Forum
- Previous Thread: Connecting to SQL
- Next Thread: stack and queue
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays bash binarysearch centimeter char convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic fflush file fork frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o ide inches infiniteloop initialization interest kilometer km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming spoonfeeding stack standard strchr string strings structures suggestions system systemcall test testautomation unix user voidmain() wab win32api windows.h





