Infinite Loops
Learn to identify and handle infinite loops in C++. Understand common programming errors that cause loops to never exit and discover intentional uses like event-driven programming, server applications, and interactive command shells to keep programs running continuously.
As already seen, a common programming mistake is creating an infinite loop. An infinite loop refers to a loop that will never exit under certain valid (or at least plausible) input. This could be because the loop variable is modified so that the exit condition is never met.
Note: Beginning programmers should be careful to examine all the possible inputs into a loop to ensure that for each such set of inputs, there is an exit condition that will ...