title: How to push int in vector<vector<int> >
body: <p>Hey Guys I got the following problem, I implemented an graph by</p>
  
  <pre><code>int v= 26;
  vector&lt;int&gt; adj[v];
  </code></pre>
  
  <p>And I'm pushing my values like this in this adjacency list:</p>
  
  <pre><code>void add_edge_directed(vector&lt;int&gt; adj[], int src, int dest)
  {
      adj[src].push_back(dest);
  }
  </code></pre>
  
  <p>This runs great but I have the problem that my array is a static value not a dynamic value. So I thought it would be nice to have a vector> which expands dynamic. So I tried this</p>
  
  <pre><code>vector&lt; vector&lt;int&gt; &gt; adj;
  </code></pre>
  
  <p>and I tried to push values in it with this:</p>
  
  <pre><code>void add_edge_vec(vector&lt;vector&lt;int&gt; &gt;adj, int src, int dest)
  {
      adj[src].push_back(dest);
  }
  </code></pre>
  
  <p>So I have no building errors but then my qtcreator in debugger mode says:</p>
  
  <blockquote>
    <p>The inferior stopped because it received a signal from the Operating
    System Signal name: SIGSEGV Signal meaning: Segmentation Fault</p>
  </blockquote>
  
  <p>The Debugger shows me the error in the stl_vector.h in the line 915</p>
  
  <pre><code>      push_back(const value_type&amp; __x)
    {
  if (this-&gt;_M_impl._M_finish != this-&gt;_M_impl._M_end_of_storage)
    {
      _Alloc_traits::construct(this-&gt;_M_impl, this-&gt;_M_impl._M_finish,
                               __x);
      ++this-&gt;_M_impl._M_finish;
    }
  </code></pre>
  
  <p>So I have no idea what I am doing wrong. It would be great if somebody could help me.</p>