Drop the leading 0 in the hexadecimal character:
printf("\x41");
Numeric literals use a prefix 0x, characters use \x.
You can also add a translation string to make sure it is displayed:
printf("\x41\n");
You can also type one character:
printf("%c\n", 0x41);
or portable:
printf("%c\n", 'a');
source
share