Why can't I find the value of EOF in C?

前端 未结 6 861
梦毁少年i
梦毁少年i 2020-12-30 13:48

I\'m reading the book \"The C Programming Language\" and there is an exercise that asked to verify that the expression getchar() != EOF is returning 1 or 0. Now

6条回答
  •  梦毁少年i
    2020-12-30 14:43

    To display the value of EOF

    #include 
    int main()
    {
       printf("EOF on my system is %d\n", EOF);
       return 0;
    }
    

    EOF is defined in stdio.h normally as -1

提交回复
热议问题