title: Vector gives 0 as output when out of bounds?
body: <p>I was playing around with nested vectors and printing random elements to see the output and I noticed that when I go out of bounds I don't get an error. I simply get 0 returned as the value.</p>
  
  <p>Why is this?</p>
  
  <p>Is the vector being resized and initialized to zero whenever I attempt to call an out-of-bounds element by index?</p>
  
  <p>Here's the code I was running:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  
  int main(){
    std::vector&lt;std::vector&lt;int&gt;&gt; matrix;
    std::vector&lt;int&gt; temp;
    temp.push_back(1);
    temp.push_back(2);
    matrix.push_back(temp);
    std::cout &lt;&lt; matrix[0][45] &lt;&lt; std::endl;
  
    return 0;
  }
  </code></pre>