Printing value of pointer in a vector of pointer c++ : <p>here is my code:</p>

<pre><code>vector&lt;int *&gt; *ptr;
int *tab = new int(20);
ptr-&gt;push_back(tab);
cout &lt;&lt; *(ptr-&gt;at(0)) &lt;&lt; endl;
</code></pre>

<p>I want to print 20 on the screen, but I got a segmentation fault.
when I use only</p>

<pre><code>vector&lt;int *&gt; ptr;
</code></pre>

<p>it prints out fine. I get easily the result just by doing :</p>

<pre><code>*ptr.at(0);
</code></pre>

<p>But I want to use a pointer not a simple variable.
Can I have some enlightenment? </p>

<p>Thanks</p>
