title: Unwanted output on second pass using strcpy
body: <p>I'm reading a book called "C programming Absolute Beginners Guide."
  The following program uses some if loops and strcpy to store some character arrays provided by the user.  The first pass of strcpy works fine.  The second produces garbage.  I understand the array needs a \0 to end.  According to the book, strcpy does this automatically.  What am I missing?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;    
  main()
  {
      int ctr, numMovies, rating, favRating, leastRating;
      char movieName[40], favorite[40], least[40];
  
      favRating = 0;
      leastRating = 0;
  
      do {
      printf("How many movies have you seen this year? ");
      scanf(" %d", &amp;numMovies);
  
      if (numMovies &lt; 1)
      {
          printf("No movies! How can you rank them?\nTry again\n\n");
      }
  
      } while (numMovies &lt; 1 );
  
      for (ctr = 1; ctr &lt;= numMovies; ctr++)
      {
  
      printf("\nWhat's the name of the movie? ");
      printf("(1-word titles only!) ");
      scanf(" %s", movieName);
  
  
      printf("On a scale of 1 to 10, what would ");
      printf("you rate it? ");
      scanf(" %d", &amp;rating);
  
      if (rating &gt; favRating)
      {
  
          strcpy(favorite, movieName);
  
          favRating = rating;
      }
  
              printf("%s", movieName);
      if (rating &lt; leastRating)
      { 
  
          strcpy(least, movieName);
          leastRating = rating;
      }
  
  }
  printf("\nYour Favorite Movie was %s.\n", favorite);
  printf("\nYour Least-favorite movie was %s.\n", least);
  return 0;
  
  }
  </code></pre>