title: Segmentation Fault when using fopen()
body: <p>I'm not sure why this is happening but I am getting a "Segmentation fault (core dumped)" from this very simple code. Any ideas as to why? I have to use a string to tell fopen() what file to open.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main(void) {
      char *small = "small.ppm";
      FILE * fp;
      char word[5];
      fp = fopen(small, "r");
      fscanf(fp, "%s", word);
      printf("%s\n", word);
  
      return 0;
  }
  </code></pre>