title: How do I access and print individual elements of a vector of vectors?
body: <p>I tried building a 7*3 matrix, and then printing it's elements as it's values are initialized, but unfortunately the program terminates when run. If there is a simpler,more efficient way of doing the same process, please do tell.</p>
  
  <pre><code>vector&lt; vector&lt;int&gt; &gt;  v1;
  for(int i = 0;i &lt; 7;i++)
  {
      for(int j = 0;j &lt; 3;j++)
      {
          v1[i].push_back(i + j);
          cout &lt;&lt; v1[i][j] &lt;&lt; " ";
      }
      cout &lt;&lt; "\n";
  }
  </code></pre>