5.6.3.5. Infinite Loops

A loop does not always stop. For example, if n = 10 then

  i = 0;
  while(i != n)
  {
    printf("%i\n", i);
  }
will never end. If you suspect that your program is in an infinite loop, use control-C to stop it. Consider running a debugger to find out where the problem is.


Exercises

  1. How can you stop a program that appears to be in an infinite loop? Answer