title: How do I properly compare strings in C?
body: <p>I am trying to get a program to let a user enter a word or character, store it, and then print it until the user types it again, exiting the program. My code looks like this:</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      char input[40];
      char check[40];
      int i=0;
      printf(&quot;Hello!\nPlease enter a word or character:\n&quot;);
      gets(input);   /* obsolete function: do not use!! */
      printf(&quot;I will now repeat this until you type it back to me.\n&quot;);
  
      while (check != input)
      {
          printf(&quot;%s\n&quot;, input);
          gets(check);   /* obsolete function: do not use!! */
      }
  
      printf(&quot;Good bye!&quot;);
      
  
      return 0;
  }
  </code></pre>
  <p>The problem is that I keep getting the printing of the input string, even when the input by the user (check) matches the original (input). Am I comparing the two incorrectly?</p>