Representing EOF in C code?

后端 未结 10 575
夕颜
夕颜 2020-11-29 00:24

The newline character is represented by \"\\n\" in C code. Is there an equivalent for the end-of-file (EOF) character?

10条回答
  •  独厮守ぢ
    2020-11-29 00:56

    The value of EOF can't be confused with any real character.

    If a= getchar(), then we must declare a big enough to hold any value that getchar() returns. We can't use char since a must be big enough to hold EOF in addition to characters.

提交回复
热议问题