#include <stdio.h>
#define SIZE 40
int main(void)
{
char * ptr;
char string[SIZE];
char ch;
ch = getchar();
if (ch == EOF)
puts("Enter EOF");
ptr = fgets(string, SIZE, stdin);
if (ptr == NULL)
puts("The fgets functions back the null");
return 0;
}
我在使用gcc来编译之后结果是这个样子的
输入EOF之后