title: Creating a new array in C++ using parameters not determined before the code is run
body: <p>I need to create an array with the size that a random number generator creates. Any help would be appreciated! </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  
  using namespace std;
  
  int main()
  {
      srand(time(NULL));
      int parameter;
      char newArray[] = {};
      parameter = rand() % 10;
      newArray[parameter] = {};
  
      for (int i = 0; i &lt; parameter; i++)
      {
          cout &lt;&lt; "Enter a character: ";
          cin &gt;&gt; newArray[i];
      }
      for (int i = 0; i &lt; parameter; i++)
      {
          cout &lt;&lt; newArray[i];
          return (0);
      }
  }
  </code></pre>