What is the output of the following C program on 64-bit Linux or macOS?
#include <stdio.h>
int main(void) {
char d = '7';
int n = d - '0';
printf("%d %d\n", n, d);
return 0;
}
The digit characters '0' to '9' have consecutive codes (guaranteed by the standard), so subtracting '0' gives the digit's value. Printed with %d, the character '7' itself is its code, 55.