title: Checking if two strings match
body: <p>I am trying to check whether an user input matches a variable in my program.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  char* subject1 = "math";
  char input[10];
  
  int main() 
  {
      printf("Subject: ");
      scanf("%s", input);
  
      if(strcmp(input,subject1) == 0)
      {
          printf("cpi\n");
      }
      else if(strcmp(input,subject1) == 0)
      {
          printf("math\n");
      }
  
      return 0;
  }
  </code></pre>
  
  <p>If I input the string "math",I get <code>cpi</code> in the output, instead of <code>math</code>. Why?</p>