In addition @David Ranieri fine answer, I wanted to explain about the "output gives me only ?????????? characters."
"%c"
accepts an int
argument. Recall a char
passed to a ...
function is converted to an int
. Then
the int
argument is converted to an unsigned char
, and the resulting character is written. C17dr § 7.21.6.1 8.
Thus printf("%c" ...
handles values 0-255. Values outside that range being converted to that range.
OP's code below re-written in hex.
// for (int i = 12784; i <= 12799; i++) {
for (int i = 0x31F0; i <= 0x31FF; i++) {
printf("%c\n",i);
}
With OP locale setting and implementation, printing values [0xF0 - 0XFF] resulted in '?'
. I am confident that is true for [0x80 - 0xFF] for OP. Other possibilities exist. I received �
.
Had OP done the below, more familiar output would be seen, though not the Hiragana characters desired.
for (int i = 0x3041; i <= 0x307E; i++) {
printf("%c",i);
}
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~