title: C - Comparing string literal with character array
body: <p>I am new to C and am still a bit confused about how to use strings via character arrays.</p>
  
  <p>In my C program, I am accepting commands from the user:</p>
  
  <pre><code>char command[20];
  scanf("%s",command);
  </code></pre>
  
  <p>Of course, afterwards I want to figure out what command they typed (something similar to: "<code>if (command == "hello")</code>, then do something"). I know this is not possible in C because I am comparing a string literal to a character array, but what would be a good way to it? I have tried using <code>strcmp(command, "hello")</code> and still got errors.</p>
  
  <p>Any advice you can provide would be very appreciated. Thank you!</p>