title: Why can't I cause a seg fault?
body: <p>OK for whatever reason I'm having trouble causing a seg fault. I want to produce one so that I can use <code>gdb</code> to see how to debug one. I have tried both examples from <a href="http://en.wikipedia.org/wiki/Segmentation_fault" rel="noreferrer">the Wikipedia</a> article yet neither work.</p>
  
  <p>The first one:</p>
  
  <pre><code>char *s = "Hello World!";
  *s = 'H';
  </code></pre>
  
  <p>And the second example:</p>
  
  <pre><code>int main(void) 
  {
      main();
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> I'm using Ubutnu 9.10 and <code>g++</code> as my compiler. Can anyone show me some code that is guaranteed to segfault?</p>