title: strcmp() thinks that strings arent equal.. but are they?
body: <p>For unknown reason, result of running my C program is quite unexpected. I think that it has to be some kind of a beginner mistake, however I can't find out really, where is it.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  int main()
  {
  char string1[50];
  char string2[50];
  int compare;
  
  puts("Enter two strings: ");
  fgets(string1, strlen(string1)+1, stdin);
  fgets(string2, strlen(string2)+1, stdin);
  
  compare=strcmp(string1, string2); /* usage of extra variable makes the code more readable but wastes more memory */
  
  printf("%d: ",compare);
  
  if (compare&lt;0) puts("First string is lesser");
  else if (compare&gt;0) puts ("First string is bigger");
       else puts("Strings are equal");
  
  
  return 0;
    }
  </code></pre>
  
  <p>And on testing:</p>
  
  <pre><code>Enter two strings: 
  heheisntthisalongstring
  heheisntthisalongstring
  1: First string is bigger
  
  
  ------------------
  (program exited with code: 0)
  Press return to continue
  </code></pre>
  
  <p>Shouldn't those strings be equal? </p>