title: Segmentation fault in C on Mac, direct copy from a tutorial
body: <p>I've started learning C and pointers and I've been working on tutorials on the internet. I assume that the code should work as it is in a tutorial, and it seems right to me, but I get a segmentation error. The code is:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  /*
   * 
   */
  int main(int argc, char** argv) {
      float fl = 3.14;
      unsigned int addr = (unsigned int) &amp;fl;
      printf("fl's address=%u\n", addr);
      printf("addr's contents = %.2f\n", * (float*) addr);
      return (EXIT_SUCCESS);
  }
  </code></pre>
  
  <p>The error that I get is </p>
  
  <pre><code>/Applications/NetBeans/NetBeans       
  6.9.1.app/Contents/Resources/NetBeans/ide/bin/nativeexecution/dorun.sh: line 33:  1626     
  Segmentation fault      sh "${SHFILE}"
  </code></pre>
  
  <p>Does this have to do with me using a Mac or is there something wrong with the code?</p>
  
  <p>Thanks a lot,
  Niek</p>