title: How do you use a string array in a conditional statement in C?
body: <p>I want to use a string array in an if statement to test whether the input string matches any of the strings in the array.<p>
  So far this is what I've tried:</p>
  
  <pre><code>void checkForError(char input[50])
  {
  
      const char *input2[]={"print","loadStarter","terminate()"};
  
      if(input != input2)
      {
          printf("Error:Incorrect method '%s'.\n",input);
      }
      else
      {
          abort();
      }
  }
  </code></pre>
  
  <p>And if I were to enter something in the array like "print" it would end up showing me:</p>
  
  <blockquote>
    <blockquote>
      <p>Error:Incorrect method 'print'.</p>
    </blockquote>
  </blockquote>
  
  <p>but when I try something not listed in the array like "g" it repeats the error message nonstop.</p>
  
  <p>I was thinking perhaps something like this could work:</p>
  
  <pre><code>void checkForError(char input)
  {
    if(strcmp(input,"print"))!=0 || strcmp(input,"loadStarter"))!=0 || strcmp(input,"terminate()")
    {
      printf("Error:Incorrect method '%s'.\n");
    }
    else
    {
      abort();
    }
  }
  </code></pre>
  
  <p>But it turns out that actually doesn't work so what do I do?</p>