What is the ascii value of EOF in c.?

前端 未结 7 786
隐瞒了意图╮
隐瞒了意图╮ 2020-12-01 13:51

Any one knows what is the ASCII value of i.

I try printf(\"%d\",EOF);

but its print -1

and also try printf(\"%c\",EOF

相关标签:
7条回答
  • 2020-12-01 14:42

    EOF (as defined in the C language) is not a character/not an ASCII value. That's why getc returns an int and not an unsigned char - because the character read could have any value in the range of unsigned char, and the return value of getc also needs to be able to represent the non-character value EOF (which is necessarily negative).

    0 讨论(0)
提交回复
热议问题