title: C# default value of a pointer type
body: <p>I have been searching through the C# language spec and I can't find anything which says whether a pointer type (e.g. <code>int*</code>) gets initialized with a default value. I created a simple test app and it appears to initialize them to zero but I'd like to confirm this with the spec. </p>
  
  <p>I started looking for this because I noticed in reflector the <code>IntPtr</code> class uses this code to define its <code>IntPtr.Zero</code>:</p>
  
  <pre><code>public struct IntPtr : ISerializable
  {
     private unsafe void* m_value;
     public static readonly IntPtr Zero;
  
     .......
  
     public static unsafe bool operator ==(IntPtr value1, IntPtr value2)
     {
         return (value1.m_value == value2.m_value);
     }
  
     ........
  }
  </code></pre>
  
  <p>which means that when you compare against <code>IntPtr.Zero</code> it actually is comparing against the default value assigned to the <code>m_value</code> field which has type <code>void*</code>.</p>
  
  <p>Thanks.</p>