title: Memory location of null pointer
body: <p>After reading a lot of questions about null pointers, I still have confusion about memory allocation in null pointer.</p>
  
  <p>If I type following code-</p>
  
  <pre><code>int a=22;
  int *p=&amp;a;//now p is pointing towards a
  std::cout&lt;&lt;*p;//outputs 22
  std::cout&lt;&lt;p;//outputs memory address of object a;
  int *n=nullptr;// pointer n is initialized to null
  std::cout&lt;&lt;n;
  </code></pre>
  
  <p>After compiling this code pointer n outputs literal constant 0, and if i try this,</p>
  
  <pre><code>std::cout&lt;&lt;*n;
  </code></pre>
  
  <p>this line of code is compiled by compiler but it is unable to execute, what is wrong in this code, it should print memory location of this pointer.</p>
  
  <pre><code>std::cout&lt;&lt;p;
  </code></pre>
  
  <p>does this output location of pointer in memory or location of an object in memory.
  Since many or all of these answers are already answered in previous questions but somehow i am unable to understand because I am beginner in C++.</p>