title: Attempting to access a null pointer
body: <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
      int* i = 0;
      int x = (*i);
      std::cout &lt;&lt; x;
  }
  </code></pre>
  
  <p>The above program will crash when I compile and run it using <code>Visual Studio 2010</code> and I know it crashes because I set the pointer to 0.</p>
  
  <p>What I would like to know, is accessing a <code>null pointer</code> in C++ defined in the standard or is it undefined and I just happen to get lucky that my program crashed because of my compiler/computer/operating system</p>
  
  <p>If it is defined, what does C++ guarantee me when I try and access a null pointer?</p>