How to convert ASCII code to corresponding int using getchar?

Viewed 388

I basically want to know what to put in the last printf statement for the first %d, because from my understanding getchar converts the inputted character to ASCII code. So how do I display the inputted character?

#include <stdio.h>

int main(void) {
    int c;
    printf("Enter a character: ");
    c = getchar();
    printf("The ASCII code for the character %d is %d\n", what to put here, c);
    return 0;
}
1 Answers
Related