Note: EOF The C programming language,

Reading <<The C programming luange>>,a pragram

 

#include <stdio.h>

main()
{
      int c;
      while((c=getchar())!=EOF)
      {
            putchar(c);
      }
}

 

1. EOF means end of file.

2 .Ctrl+z can end the loop.

3. EOF is an integer, so variable c must be int (char is not enough to hold EOF)

4. the value EOF is -1(VC6.0), but if you input -1,getchar() first get -,then second time get 1

你可能感兴趣的:(C++,c,C#)