title: C++ vector issues
body: <p>My application keeps crashing on me for whatever reason. I am new to vectors so there is more than likely something silly on my part.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;    
  
  using namespace std;
  
  class Projectile
  {
  private:
      SDL_Surface *projectile;
      void load();
  
  public:
      int count;
  
      vector&lt; int &gt; c;
      vector&lt; vector&lt; int &gt; &gt; p;
  
      int positionX;
      int positionY;
  
      Projectile();
      void newProjectile( int, int );
      void drawCurrentState( SDL_Surface* );
  };
  
  ...
  ...
  
  void Projectile::newProjectile( int x, int y )
  {
      positionX = x;
      positionY = y;
  
      c.push_back( 10 );
      c.push_back( 10 );
  
      //p.push_back( c ); //trying to start off simple before i do multidimensional.
  }
  
  void Projectile::drawCurrentState( SDL_Surface* destination )
  {   
      SDL_Rect offset;
      offset.x = c[0]; //will eventually me the multidimensional p vector
      offset.y = c[1]; //
  
      SDL_BlitSurface( projectile, NULL, destination, &amp;offset );
  }
  </code></pre>
  
  <p>what exactly am I doing wrong here? I push back two values ( will be the x and y ints after done testing ) however it seems to crash when it gets to the <code>offset.x = c[0];</code> part of the script.</p>
  
  <p>I thought for certain both c[0] and c[1] should be equal to 10. Any suggestions?</p>