Nested Loop
"In Computer Science a nested loop is a loop within a loop, an inner loop within the body of an outer loop."
How this works is that the first pass of the outer loop triggers the inner loop, which executes to completion.
In Simple Words - consider yo have to plot a graph , so you need (x,y) point... Similarly the outer for loops provide you x values and the inner for loop provides y values.
Then the second pass of the outer loop triggers the inner loop again.
This repeats until the outer loop finishes.
0rIn Simple Words - consider yo have to plot a graph , so you need (x,y) point... Similarly the outer for loops provide you x values and the inner for loop provides y values.
Of course, a break within either the inner or outer loop would interrupt this process.
The concept of Nested loop is very Important. Nested loop is very useful in Advance programming.
Syntax -
For Example -
Please watch this video ...to understand nested loop clearly.
Generally Nested Loops used in pattern programming...
Please follow this link -http://www.programiz.com/article/c%2B%2B-programming-pattern
Comments
Post a Comment