title: Correct use of Stat on C
body: <p>Why does this work :</p>
  
  <pre><code>char *fd = "myfile.txt";
  struct stat buf;          
  
  stat(fd, &amp;buf);
  int size = buf.st_size;
  
  printf("%d",size);
  </code></pre>
  
  <hr>
  
  <p>But this does not work:</p>
  
  <pre><code>char *fd = "myfile.txt";
  struct stat *buf;          
  
  stat(fd, buf);
  int size = buf-&gt;st_size;
  
  printf("%d",size);
  </code></pre>