As far as I know a nested loop is nothing more than a loop within another loop...
Code:
for(int i = 0; i < 10; i++)
printf("%d ", i);
this loop will print values from 0 to 9.
now a loop within that loop
Code:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
int main(void)
{
for(int i = 0; i < 10; i++){
printf("%d: ", i);
for(int j = 0; j < 10; j++)
printf("%d ", j);
std::cout.put(0xA);
}
getchar();
return(0);
}
The first loop will execute 10 times. This will execute the inner loop each time the first loop executes, and the inner loop prints the values from 0 to 10 on the screen each time it is executed. In other words it will print 0 to 10 ten times. When control reaches the inner loop, it enters in a loop and only passes control to the first for loop once the variable j is not lower than ten, and then it repeats.