Displays code number for a character - C Data Type

C examples for Data Type:int

Description

Displays code number for a character

Demo Code


#include <stdio.h>

int main(void){
    char ch;// ww w . ja  va 2 s.c om
    
    printf("Please enter a character.\n");
    scanf("%c", &ch);   /* user inputs character */
    printf("The code for %c is %d.\n", ch, ch);
    
    return 0;
}

Result


Related Tutorials