title: How to store a user input char character into a variable/array?
body: <p>I'm making a unit converter calculator (ignore the function names they are reversed for a couple of them) and I'm trying to store a user input <code>char</code> character (ie. m, g, or c) to represent the unit they want to be converted. My code gets stuck at the <code>scanf()</code> function, and not sure why it won't take a single <code>char</code> character when I specify the <code>userUnit</code> <code>array</code> length to 2 (one to hold the null terminator). Any thoughts?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  //Function prototypes
  double fahrToCelc(double cel);
  double meterToFoot(double foot);
  double poundToGram(double pound);
  
  int main(){
      double conversions;
      char userUnit[2];
      char letter[4] = "gmc";
  
      //User inputs
      scanf("%lf %s",&amp;conversions, userUnit);
  
      if(userUnit[0] == letter[0]){        
          printf("%.6lf lb",poundToGram(conversions));
  
      }else if(userUnit[0] == letter[1]){
          printf("%.6lf ft",meterToFoot(conversions));
  
      }else if(userUnit[0] == letter[2]){        
          printf("%.6lf f",fahrToCelc(conversions));
      }
  
      return 0;    
  }
  
  //Function declarations
  double fahrToCelc(double cel){
      double fahr = 32 +(1.8*cel);
      return printf("%lf",fahr);
  }
  
  double meterToFoot(double meter){
      double foot = meter*0.3048;    
      return printf("%lf", foot);
  }
  
  double poundToGram(double gram){
      double pound = gram/0.002205;    
      return printf("%lf",pound);
  }
  </code></pre>