title: Compare strings in C using getchar
body: <p>I know this has been asked before and I've read through the answers.  I also know that my code isn't great as I'm still learning C.  I'm trying, without any luck, to compare a user entered char with a char in an if statement.  All and any advice is appreciated.  Also, I'm aware of buffer issues though just trying to get the comparison to work first.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;string.h&gt;
  
  int main(void){
  
  //int n;
  //const char *F = "F";
  //float temp;
  //float converted;
  
  printf("Would you like to enter Fahrenheit or Celcius? Please type F or C: ");
  //scanf("%c", &amp;a);
  char input = getchar(); //This will get a single Char from the user and keep it as a char
  
  printf("%c\n", input);
  
  //n = strcmp(input, F);
  
  if(input == "C") {  
  
          printf("Please enter the temp you would like to convert to Fahrenheit: ");
          scanf("%f", &amp;temp);
          converted = temp * 9/5 +32;
  
          printf("You entered %2f Celcius and that equals %2f Fahrenheit\n", temp, converted);
  
  }else if(strcmp(input, "f") == 0) || (strcmp(input, "F") == 0){
  
          printf("Please enter the temp you would like to convert to Celcius: ");
          scanf("%f", &amp;temp);
  
    }else{
  
          printf("You didn't enter F or C");
  
     }
  
  
  
  }
  </code></pre>