title: c++ char array input - explanation
body: <p>I have an exercise to write a program that receives a sentence and then takes from each word the first letter and creates a new word.</p>
  
  <p>My code: </p>
  
  <pre><code>int main(){
  
  char* str = new char[50];
  
  for (int i = 0; i &lt; 50; i++)
      str[i] = NULL;
  
  cin &gt;&gt; str; 
  
  cout&lt;&lt;str;
  
  for (int i = 0; i &lt; 50; i++) 
      cout &lt;&lt; str[i]; 
  
  
  system("pause");
  return 0;
  } 
  </code></pre>
  
  <p>But when I want to print the sentence it prints only the first word. </p>
  
  <pre><code>input: 
  abcdef abc des
  
  output: 
  abcdef abc des
  abcdef *******************************************
  </code></pre>
  
  <p>And when I press a space what goes into the array?
  How can I know when I'm running on the array with the FOR loop When do I get to the Character where there is space?</p>