Debugging Challenges Explanation

The debugging challenges are a set of challenges presenting code with an error of some sort causing the program to crash, not compile, or output the wrong result. To solve these challenges, you must describe the cause of the problem and outline a reasonable solution. No code-writing is necessary to complete these challenges, and in fact if you just resubmit the code with changes made to it your answer will be rejected.

Note that answers are checked by an admin, so you will not get credit immediately. Answers should be less than 500 characters.

Here is an extremely simple example:

//I want my code to output 0+1+2+3+4+5, but it's not working! What's wrong?
int main()
  int y = 0;
  for(int x=0; x<5; x++)
    y = y + x;
  printf("Sum: %d\\n", y);
  return 0;

A good solution:
The problem is on line 6. It is only iterating over 0 through 4. To solve this, you could change the exit condition for the loop to be "x<=5".

A bad solution:
Line 6.

Another bad solution:
The problem is that it prints 10 when it should be 15. To solve this, change line 8 to: printf("Sum: 15\\n");

Note: If you just submit code and don't explain what the issue is or why your code solves it, your answer is wrong even if the code works!