title: C++ Pointers Dilemma
body: <p>I have been playing with pointers in C++ for the last few hours.<br>
  Then I got stuck on this...</p>
  
  <pre><code>vector&lt;int&gt; one[3]; 
  vector&lt;int&gt;* two[3]; 
  vector&lt;vector&lt;int&gt; &gt; three(3);
  vector&lt;int&gt;** four = new vector&lt;int&gt;*[3];
  </code></pre>
  
  <p>I would like to create an array(or a vector) that contains 3 vectors of integers.<br></p>
  
  <p>What I think I know (correct me if I'm wrong):</p>
  
  <ul>
  <li>ONE is an array of three std::vector objects (all of them are being initialized using the default constructor, I guess)</li>
  <li><p>TWO is an array of three std::vector pointers. It means that I have to dynamically alloc the three pointers, like this:</p>
  
  <pre><code>two[0] = new vector&lt;int&gt;();
  two[1] = new vector&lt;int&gt;();
  two[2] = new vector&lt;int&gt;();
  </code></pre></li>
  <li><p>THREE is a vector that contains three std::vector initialized objects.</p></li>
  <li>FOUR is a pointer to the first of three std::vector pointers.</li>
  </ul>
  
  <p>Which is the best way to achieve that (and why?)<br></p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>This is the the output of LLDB when I print those variables.<br>
  <a href="http://pastebin.com/raw.php?i=JLyeB4uK" rel="nofollow">http://pastebin.com/raw.php?i=JLyeB4uK</a><br>
  It doesn't sound right...</p>
  
  <p>Code is:</p>
  
  <pre><code>//METHOD ONE: 
  vector&lt;int&gt; one[3];  
  //METHOD TWO:
  vector&lt;int&gt;* two[3]; 
  two[0] = new vector&lt;int&gt;();
  two[1] = new vector&lt;int&gt;();
  two[2] = new vector&lt;int&gt;();
  //METHOD THREE: 
  vector&lt;vector&lt;int&gt; &gt; three(3);
  //METHOD FOUR:
  vector&lt;int&gt;** four = new vector&lt;int&gt;*[3]; 
  four[0] = new vector&lt;int&gt;();
  four[1] = new vector&lt;int&gt;();
  four[2] = new vector&lt;int&gt;();
  </code></pre>
  
  <p>Thanks :)</p>