title: copying one pointer to other in C++
body: <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main(int argc, char **argv) {
      int a=5;
      int *p,*q;
  
      *p = a;
      *q = *p;  //line 6
  
      cout&lt;&lt;*p&lt;&lt;p&lt;&lt;*q&lt;&lt;q;
  
      return 0;
  }
  </code></pre>
  
  <p>This program hangs. It seems the problem is on line 6. Why is that?</p>