Monday, November 07, 2005

elementary C


Sorry for this dum question but: In elementary C programing examples
such as Kernighan and Ritchie the function getchar is used with EOF
such as: ...while ( c != EOF) ... where c = getchar() is it
possible to enter EOF from the keyboard. Entering -1 does not seem to
work.

1 Comments:

At 10:18 PM, November 29, 2005, Anonymous Anonymous said...

its usually ctrl-z in windows and is OS dependant.
in case of unix systems it depends on ur terminal (emulator, chk termcap)(usually ctrl-d). We use EOF defined in stdio so that os portability is ensured ( also EOF is usually an int and chking it against a char is not recomm)

 

Post a Comment

<< Home