title: how to pass on value to an integer pointer
body: <pre><code>#include&lt;stdio.h&gt;
  
  int main ()
  {
      int *ip;
      printf("Enter a no \n");
      scanf("%d",ip);
      printf("ip=%d",*ip);
  }
  </code></pre>
  
  <p>Above is my program and when I run it following is output</p>
  
  <pre><code>./a.out 
  Enter a no 
  10
  Segmentation fault
  </code></pre>
  
  <p>I checked in gdb line 6 is problem which is </p>
  
  <p><code>scanf("%d",ip);</code></p>
  
  <p>So I infer that <code>ip</code> is a pointer to integer and <code>%d</code> expects an address value.
  While I am trying to pass on an integer to the value specified by <code>ip</code> so I think that is wrong. But what is the correct thing to do in the above situation. I want to use scan and assign an integer value to the address pointed to by <code>ip</code> (which in my case is missing).</p>