title: How do I cast a pointer to an int
body: <p>I'm trying to store the value of an address in a non pointer int variable, when I try to convert it I get the compile error "invalid conversion from 'int*' to 'int'" this is the code I'm using:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  vector&lt;int&gt; test;
  
  int main() {
      int *ip;
      int pointervalue = 50;
      int thatvalue = 1;
  
      ip = &amp;pointervalue;
      thatvalue = ip;
  
      cout &lt;&lt; ip &lt;&lt; endl;
  
      test.push_back(thatvalue);
  
      cout &lt;&lt; test[0] &lt;&lt; endl;
      return 0;
  }
  </code></pre>