Discussion
if(scanf("%f", &x) == EOF)
action
else
. . .
Is the same as
n = scanf("%f", &x);
if(n == EOF) ...
The value n will be the number of items read, or EOF if end-of-file is reached.
The use in while(scanf()!=EOF){ ...
is similar.
Previous slide
Next slide
Back to first slide
View graphic version