title: fread error - segmentation fault
body: <p>Here is my code
  Name of file <em>filewrite.c</em></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  void main()
  {
  
      int *p; 
      *p = 5;
      FILE *fp1 = fopen("sample.txt","w");
      fwrite(&amp;p,sizeof(int),1,fp1);
      fclose(fp1);
  
      printf("\n Value of p written into the file is :%d \n",*p);
  
   int *q;
   FILE *fp2 = fopen("sample.txt","r");
   fread(&amp;q,sizeof(int),1,fp2);
   fclose(fp2);
  
   printf("\n Value of q read from the file is :%d \n",*q);
  
   }
  </code></pre>
  
  <p>Output as seen on the terminal on linux:</p>
  
  <pre><code>$&gt;gcc -o filewrite.o filewrite.c
  
  $&gt;filewrite.o
  
  $&gt;Segmentation fault (core dumped)
  </code></pre>
  
  <p>I am able to see a file <code>sample.txt</code> written out. But unable to understand why there is a core dump.</p>