title: Is it possible to dynamically allocate a vector?
body: <p>I was told on here to use vectors instead of arrays for this particular solution ( <a href="https://stackoverflow.com/questions/42520507/pointersissue-with-calculating-an-average-function-after-dropping-a-test-score/42520600#42520600">My original solution using to dynamically allocate arrays</a>) my problem is I don't really understand vectors, my book only covers a small section. So, maybe I am doing something wrong? I'm just trying to learn a different way in solving it with vectors. So, when I ask is it possible to dynamically allocate a vector. What I mean is it legal to do this  <code>std::vector&lt;int*&gt; vect= nullptr;</code>, if not why? Also it would be really helpful to see an example how to modify my original solution with vectors.  I'm a beginner just trying to learn from my mistakes.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  void sortAscendingOrder(int*, int );
  void LowestTestScore(int*, int);
  void calculatesAverage(int*,int);
  int main()
  {
      std::vector&lt;int*&gt; vect= nullptr;
      int input;
  
      std::cout &lt;&lt; "Enter the number of testscores you want to enter." &lt;&lt;std::endl;
      std::cin &gt;&gt; input;
  
      vect = new int[input];
  
      for(int count =0; count &lt; input; count++)
      {
          std::cout &lt;&lt; "Enter the test score" &lt;&lt; (count +1) &lt;&lt;":" &lt;&lt;std::endl;
          std::cin &gt;&gt; vect[count] ;
          while( vect[count] &lt; 0)
          {
              std::cout &lt;&lt;"You enter a negative number. Please enter a postive number." &lt;&lt;std::endl;
              std::cin &gt;&gt; vect[count];
          }
      }
  
      sortAscendingOrder(vect,input);
  
      for(int count =0; count &lt; input;count++)
      {
          std::cout &lt;&lt; "\n" &lt;&lt;vect[count];
          std::cout &lt;&lt; std::endl;
      }
      LowestTestScore(vect,input);
      calculatesAverage(vect,input);
  
  
  
      return 0;
  }
  void sortAscendingOrder(int* input,int size)
  {
      int startScan,minIndex,minValue;
  
      for(startScan =0; startScan &lt; (size-1);startScan++)
      {
          minIndex = startScan;
          minValue = input[startScan];
          for(int index = startScan+1;index&lt;size;index++)
          {
              if(input[index] &lt; minValue)
              {
                  minValue = input[index];
                  minIndex = index;
              }
          }
          input[minIndex]=input[startScan];
          input[startScan]=minValue;
      }
  }
  void LowestTestScore(int* input, int size)
  {
      int count =0;
      int* lowest = nullptr;
      lowest = input;
      for(count =1; count &lt;size;count++)
      {
          if(input[count] &lt; lowest[0])
          {
              lowest[0] = input[count];
          }
      }
      std::cout &lt;&lt; "Lowest score" &lt;&lt; *lowest;
  }
  void calculatesAverage(int* input, int size)
  {
      int total = 0;
      int average =0;
      for(int count = 0; count &lt; size; count++)
      {
          total += input[count];
  
      }
      average =(total/size-1);
      std::cout &lt;&lt; "Your average is" &lt;&lt; average;
  }
  </code></pre>