title: Variable-sized object array may not be initialized
body: <p>So I have to type a college program menu that asks a series of questions using strings, and arrays. </p>
  
  <p>I have this typed up currently. </p>
  
  <p>`</p>
  
  <pre><code>    #include &lt;iostream&gt;
  
      #include &lt;fstream&gt;
  
      #include &lt;vector&gt;
  
      #include &lt;string&gt;
  
  using namespace std;
  
  vector&lt;string&gt; populateVector();
  void populateArray(string *, int &amp;);
  void menu();
  
  int main()
  {
      vector&lt;string&gt; collegesVector = populateVector();
      int sizeOfArray = collegesVector.size();
      string statesArray [sizeOfArray] = {};
      populateArray(statesArray, sizeOfArray);
  
      cout &lt;&lt; "\nWELCOME TO MY COLLEGE AND UNIVERSITY SUMMARY PROGRAM."
      cout &lt;&lt; "\n Press 1 to enter possible colleges and universities and the program will tell you if they appear on the list."
  
      system("pause&gt;nul");
  
  
  do
  {
      cout &lt;&lt; "\nPress 1 to enter possible colleges and universities and the program will tell you if they appear on the list.";
      cout &lt;&lt; "\nPress 2 to find out how many colleges and universities appear in the state of your choice.";
      cout &lt;&lt; "\nPress 3 to find out how many colleges and universities appear on our list in total.";
      cout &lt;&lt; "\nPress 4 to quit";
  
      if (choice == 1)
  {
    do
    {
        cout &lt;&lt; "Please enter the name of your college or university. ";
        cin &gt;&gt; userInput;
  
        collegesVector(resemblance);
  
        if(userInput != resemblance)
          cout &lt;&lt; "\nThe institution you've entered is not on the list.\n";
        else
          cout &lt;&lt; "\nThe institution you've entered is on our list!.\n";
  
  
  
    }
  }
  
  }
  
  
  vector&lt;string&gt; populateVector()
  {
      string marker;
      string entry;
      vector&lt;string&gt; collegesVector;
      fstream inputFile;
      inputFile.open("colleges.txt");
      if (!inputFile)
      {
          cout &lt;&lt; "cannot read";
          return vector&lt;string&gt;();
      }
  
      getline(inputFile, marker);
  
      while(!inputFile.eof())
      {
          getline(inputFile, entry);
  
          if(entry.length() &gt; 0)
          {
              collegesVector.push_back(entry);
          }
  
      }
      inputFile.close();
      return collegesVector;
  }
  void populateArray(string * statesArray, int &amp; sizeOfArray)
  int statesArray[] = {};
  {
      fstream inputFile;
      string marker;
      string entry;
      inputFile.open("states.txt");
      if (!inputFile)
      {
          cout &lt;&lt; "cannot read";
          return;
      }
      getline(inputFile, marker);
  
      for(int i = 0; i &lt; sizeOfArray; i++)
      {
  
          getline(inputFile, entry);
  
          if(entry.length() &gt; 0)
          {
              statesArray[i] = entry;
          }
      }
     inputFile.close();
  
  
  
  }
  </code></pre>
  
  <p><strong>It keeps on giving me the "Variable-sized object 'statesArray' may not be initialized error and I really cant point my finger on why it wont :\ thanks in advanced.</strong></p>