How can I convert ASCII code to corresponding int using getchar?
Basically I want to know what to put in the last statement printf
for the first %d
one because from my understanding it getchar
converts the entered character to ASCII code. So how do I display the entered 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;
}
+3
source to share