title: Get a segment fault while reading a file
body: <p>I want to read the whole file content and print it out , but I get a segment fault , I can't find what's wrong with the code ...</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  int main()
  {
      FILE * file;
      long fsize;
      file = fopen("./input.txt","r");
      if(file != NULL){
  
          //get file size
          fseek(file,0,SEEK_END);
          fsize = ftell(file);
          rewind(file);
  
          // print
          char * file_content;
          fgets(file_content,fsize,file);
          puts(file_content);
      }
      else{
          printf("open failure\n");
      }
      fclose(file);
  
      return 0;
  }
  </code></pre>