+ 4
What is the use of Nested Loop?
6 odpowiedzi
+ 8
When we use a loop inside another loop it is called nesting of loop. This loop can be used to access the elements of a multidimensional array or you can use it to make patterns etc...
+ 12
You can use it for a number of purposes.
1. To access elements of a multi dimensional array
2. To access string elements
3. To print patterns of characters
4. To check for the working of a particular inside loop body
5. It is also used with complex if else structures
+ 6
Useful for printing patterns and in iterating over multidimensional arrays and data structures.
+ 3
Like others have already said, it is used in the multidimensional array or vector, and it is also used for sorting algorithom. Bubble Sort would be a example of this.
+ 2
Nesting loops is a great way to reduce the amount of code needed in a program. Unless you require a linear solution.
I mostly use nested loops for data matrix generation. Which then reads the matrix and writes a linear file for use in a cnc drill.
0
Loop insiade another loop