All letters of the alphabet, symbols, and number keys on the keyboard have ASCII codes : char read « Data Type « C Tutorial






ASCII code values range from 0 to 127.

#include <stdio.h>
 
int main()
{
    char key;
 
    printf("Press a key on your keyboard:");
    key=getchar();
    printf("You pressed the '%c' key.\n",key);
    printf("Its ASCII value is %d.\n",key);
    return(0);
}
Press a key on your keyboard:1
      You pressed the '1' key.
      Its ASCII value is 49.








2.12.char read
2.12.1.Reading and Writing Single Characters: scanf(%c,&key)
2.12.2.The getchar() function
2.12.3.Reading characters and strings
2.12.4.All letters of the alphabet, symbols, and number keys on the keyboard have ASCII codes