title: Vectors of pointers C++
body: <p>I have to create a list of vectors of pointers to class objects. However, It seems that upon initializing vectors, there is no content written into them.
  Here's the code :</p>
  
  <p>main.c</p>
  
  <pre><code>#include "circle.h"
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main(){
  vector&lt;Circle *&gt;vectors(2);
  vectors.push_back(new Circle("Circle1" , 4 , 0 , 0));
  cout &lt;&lt; vectors[0]-&gt;name &lt;&lt; endl;
  
  return 0;
  
  }
  </code></pre>
  
  <p>circle.h</p>
  
  <pre><code>#ifndef CIRCLE_H
  #define CIRCLE_H
  
  #include &lt;string&gt;
  
  class Circle
  {
  public:
      std::string name;
      int radius;
      int x;
      int y;
  
      Circle();
      Circle(std::string givenName, int givenRadius , int givenX , int     givenY);
      double circleLength(int radius);
      ~Circle();
  };
  
  
  #endif // CIRCLE_H
  </code></pre>
  
  <p>circle.cpp</p>
  
  <pre><code>#include "circle.h"
  #include &lt;iostream&gt;
  
  
  const double PI  =3.141592653589793238463;
  
  
  
  Circle::Circle(std::string givenName , int givenRadius, int givenX, int  givenY)
  {
      name = givenName;
      radius = givenRadius;
      x = givenX;
      y = givenY;
  }
  
  Circle::Circle(){
  
  }
  
  double Circle::circleLength(int radius)
  {
      return 2 * PI * radius;
  }
  
  Circle::~Circle(){
  }
  </code></pre>
  
  <p>And I'm getting empty output.</p>
  
  <p>P.S : Thank you all for your help. The mistake was caused by the lack of theoretical knowledge. I thought that </p>
  
  <pre><code>vector&lt;Circle *&gt;vectors(2);
  </code></pre>
  
  <p>would allocate memory for two elements like in the array and when i start filling it up, the count would start from 0. My bad.</p>