title: How to get a character ASCII value in a integer variable?
body: <p>I'm new in C and I couldnt find the answer to my question in the forum.</p>
  
  <p>The point is, I need to get a value of deck cards from the user. So it can spread from 2 to 10 and also be 'J', 'Q', 'K' or 'A'. That means it can be a integer or a character. </p>
  
  <p>I'm trying to put it in an integer variable called "_val1". This work for any number from 0 to 10. I expected that if I typed a letter, _val1 would get the ASCII value of that character (wich I could use later for my pourposes). But instead _val1 geta value '0' and the letter is automatically passed to my next variable call (wich is _naipe1).</p>
  
  <p>How can I solve that?</p>
  
  <p>That means, how cam I use scanf to get either a integer value or the ASCII value of a character?</p>
  
  <pre><code>  short int _val1, _val2;
    char _naipe1, _naipe2;
  
    printf("Qual a 1ª carta?\n Valor:");
    scanf(" %hd", &amp;_val1);
    printf("Valor 1 = %hd \n", _val1 );
    printf(" Naipe:");
    scanf(" %c", &amp;_naipe1);
  </code></pre>