title: Length of string[] (number of elements in a string)
body: <p>I want to cout my string, everything works as it should, but when the string is shown, it immediately shows me the "example_4578.exe has stopped running" error. I have noticed that the problem is in the <strong>i &lt; str[32].length</strong> part, because when I change it to i &lt; 3, it works without any problem. How should I solve this?</p>
  
  <pre><code>std::string str[32];
  cin &gt;&gt; str[1];
  cout &lt;&lt; "str[1]=" &lt;&lt; str[1] &lt;&lt; endl;
  
  cin &gt;&gt; str[2];
  cout &lt;&lt; "str[2]=" &lt;&lt; str[2] &lt;&lt; endl;
  
  for (int i = 0; i &lt; str[32].length; i++)
  {
      cout &lt;&lt; str[i];
  }
  </code></pre>
  
  <p><strong>EDIT 1.</strong>
  I've made a huge mistake. I actually want to find the "number" of elements/words in "str". In my example, I have only designed two cins. But I actually want to design a "for" loop later on, so that the user can input as many words as he wants, so if he inputs 4 words, I want that code to return those number of words to me. How should I do this? In other words, how can I find out how many elements are in "<strong>str</strong>"?</p>