A short C program for printing out ASCII values interactivelyEdit
void main(void) {int c; while(c = getchar()) printf("%d 0x%02X\n", c, c);}
The same, but formatted less golfily:
#include <stdio.h>
int main(void) {
int c;
while ((c = getchar())) {
printf("%d 0x%02X\n", c, c);
}
return 0;
}
Assuming that’s saved into a file called a.c
, compile and run (on macOS) with:
clang a.c && ./a.out