+ 12
Value of EOF in C
Im trying to print the value of EOF (K&R) I get some symbols I dont understand before the value when printed. Could someone help explain why? https://code.sololearn.com/cnLyV6RrU5cf/?ref=app
9 odpowiedzi
+ 13
thanks @kurwus and @lion
+ 12
It should output -1.
It does output -1, but only after 2 characters that I cant explain.
+ 12
@Vlad
I figured it must have been a Sololearn problem. Thanks for clearing it up (Im away from my laptop).
And yes, Im on K&R2 ✌
+ 3
Weird. But I can tell you this: It's a SoloLearn problem. Your code works fine on gcc and outputs - 1 as it should. Keep using K&R (hopefully K&R2) though. It's a great book.
@Maged
Characters are numbers. Wether they are 8-bit ASCII encoded or 16-bit Unicode or anything. Characters are numbers. And the end of file is a character. Ergo, the end of file is a number. In Unix systems, and thus in C, end of file is a number (-1). The following line exists somewhere in stdio.h:
#define EOF -1
+ 3
yeah, as kurwius says, the space before %d in the format string is not really a space, delete it and type it again and the weird should go away. It seems something weird creeps in text copied and pasted here on SL, I've seen it before, even had unexplainable compiler errors because of this.
+ 1
i know that EOF means end of file
so i dont think that it will show you any numbers
i didn't understand what you are trying to output on the screen
0
Cool
thanx alot @Vlad serbu
0
Where is the webpage?