title: converting int to pointer
body: <p>I want to save <code>int</code> value to a pointer variable. But I get an error:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
    int *NumRecPrinted = NULL;
    int no_of_records = 10;
    NumRecPrinted = (int*)no_of_records; // &lt;&lt;&lt; Doesn't give value of NumRecPrinted
  
    cout &lt;&lt; "NumRecPrinted!" &lt;&lt; NumRecPrinted;
    return 0;
  }
  </code></pre>
  
  <p>I tried doing this but I get 0 as return: </p>
  
  <pre><code>int main()
  {
      int demo(int *NumRecPrinted);
      int num = 2;
      demo(&amp;num);
      cout &lt;&lt; "NumRecPrinted=" &lt;&lt; num;    &lt;&lt;&lt;&lt; Prints 0
      return 0;
  }
  
  int demo (int *NumRecPrinted)
  
  {
      int no_of_records = 11;
      NumRecPrinted = &amp;no_of_records;
  }
  </code></pre>
  
  <p>NumRecPrinted returns as 0</p>