In Kernighan and Ritchie's C book, Im asked to write a program to print the value of EOF
I did it right by writing:
#include <stdio.h>
void main(){
printf("%d", EOF);
}
I got it right by getting -1 as the answer...but out of curiosity I typed %f
instead of %d
. It's displaying 0.00000000
Why is that?
I got what I expected...but the latter (printing in float type), I did it out of curiosity, and thought the result should be -1.0 or something like that.