What is the difference between loop and iteration? [closed]
What kinds of data structure are used to implement loop and iteration?
Loop refers to the code... iteration refers to the process in which the content of loop is executed once.. so 1 iteration refers to 1 time execution of loop.. so basically one loop can undergo many iterations..
loop is used for fixed no. of element or certain condition occurs while iterator is used for itearing element dynamically that have different no. of elements at runtime
Only such of kind 1.
Some have tried using data structures of kind 42 for this purpose, but failed miserably.
Iteration is simply the number of time/times a loop can be executed, while loop is the code which generate or causes expressions to be iterated iteration when the loop is executing.
An example of lines of code in c++:
for(i=1; i<=10; i++)
{
cout<<"this is printed 10 times";
}
The above code is a for_loop in which the execution of the statement "this is printed 10 times" will be iterated/repeated 10 times.
精彩评论