The common pitfall that i know about loop.
Some of the pitfall are occurs because of this reason;
If the program have while loop, then the common pitfall will going to occurs if we make use of semi-column \followed by while loop parentheses.
for e.g.
Code:
while(a>=10); //this mistake will make while loop as an infinity loop.
{
//Do this statement;
}
And the second mistake that, sometime we forget to use increment or decrement of variables within while loop, and because of that mistake we get Run Time Error.
for e.g.
Code:
int i=2;
while(i<=5)
{
// Do this statement;
}
//Since the above code don't have increment or decrement for the variable i,
this will also make the above loop as an infinity loop.
This are some common mistake which are mostly done with the beginners for programming language.
Bookmarks