title: How undefined is undefined behavior?
body: <p>I'm not sure I <em>quite</em> understand the extent to which undefined behavior can jeopardize a program.</p>
  
  <p>Let's say I have this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int v = 0;
      scanf("%d", &amp;v);
      if (v != 0)
      {
          int *p;
          *p = v;  // Oops
      }
      return v;
  }
  </code></pre>
  
  <p>Is the behavior of this program undefined for <em>only</em> those cases in which <code>v</code> is nonzero, or is it undefined even if <code>v</code> is zero?</p>