title: Could not access memory under C++ vector
body: <p>I'm using a vector in my program like this:</p>
  
  <pre><code>vector&lt;vector&lt;string&gt; &gt; values;
  values[0].push_back("test words");
  </code></pre>
  
  <p>when i run the code, it shows "segment fault"</p>
  
  <p>then i try to <strong>gdb</strong> it and i got this:</p>
  
  <pre><code>Program received signal EXC_BAD_ACCESS, Could not access memory.
  Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
  0x00000001000035be in std::vector&lt;std::string, std::allocator&lt;std::string&gt; &gt;::push_back (this=0x0, __x=@0x7fff5fbff330) at stl_vector.h:602
  602     if (this-&gt;_M_impl._M_finish != this-&gt;_M_impl._M_end_of_storage)
  </code></pre>
  
  <p>What is going on here ? </p>