title: Debug Assertion Failed! (string subscript out of range)
body: <p>OK. So I am making a simple program to experiment with strings, and during one portion of the program, a <code>for</code> loop displays each letter of the string in order, vertically. I ran the program normally to check on its progress throughout coding, however when I put this in, the error occurred. Here is my code:</p>
  
  <pre><code>int main()
  {
  std::string word1 = "Chicken";
  std::string word2("Nuggets");
  std::string word3(3, '!');
  
  std::string phrase = word1 + " " + word2 + word3;
  
  std::cout &lt;&lt; "The phrase is: " &lt;&lt; phrase &lt;&lt; "\n\n";
  
  std::cout &lt;&lt; "This phrase has " &lt;&lt; phrase.size() &lt;&lt; " letters!" &lt;&lt; "\n\n";
  
  std::cout &lt;&lt; "The character at position zero is " &lt;&lt; phrase[0] &lt;&lt; "\n\n";
  
  phrase[0] = 'S';
  
  std::cout &lt;&lt; "The phrase is now... " &lt;&lt; phrase &lt;&lt; "\n\n";
  
  for (unsigned int i = 0; i &lt;= phrase.size(); ++i)
  {
      std::cout &lt;&lt; "Position " &lt;&lt; i &lt;&lt; "'s character is " &lt;&lt; phrase[i] &lt;&lt; "\n";
  }
  
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated, as is feedback on my code (as I am a rookie).</p>
  
  <p>P.S. <code>&lt;iostream&gt;</code> and <code>&lt;string&gt;</code> were included, I'm just having trouble showing it to you on<br>
  the website. Sorry!</p>