title: What does fgets do?
body: <p>It is not equal:</p>
  
  <pre><code>fgets (answer, 256, stdin);
  
  if (strncmp(answer, "sta", 4) == 0)
    printf("omg, it's equal"); 
  </code></pre>
  
  <p>This code is:</p>
  
  <pre><code>fgets (answer, 4, stdin);
  
  if (strncmp(answer, "sta", 4) == 0)
    printf("omg, it's equal"); 
  </code></pre>
  
  <p>Why? It is because in the first, answer doesn't have \0 at the 4th place I guess (if I change it to 3 instead of 4 it works). But what does fgets do? String answer in the first is <code>str \whitespace*253\0"</code>? And in the second it is <code>str\0</code>? Thank you.</p>