title: Reading space separated input into an array in C++
body: <p>What is the easiest way to read space separated input into an array?  </p>
  
  <pre><code>//input:5
          1 2 3 4 7
  
  
  
  int main() {
      int n;
      cin&gt;&gt;n;
      int array[n];
      for (int i =0;i&lt;n;i++){
          cin&gt;&gt;array[i];
      }
      cout&lt;&lt;array; 
      return 0;
  }  
  </code></pre>
  
  <p>I tried the code above but the output is 0x7ffe42b757b0.   </p>