Return value EOF of scanf in C -
scanf in c language, little confused return value.
in instruction, says:
- eof returned if end of input reached before either first successful conversion or matching failure occurs.
- eof returned if read error occurs, in case error indicator stream set.
first, not sure mean if end of input reached before first successful conversion or before matching failure occurs. how possible?
second, not sure difference between read error , matching failure?
first, not sure mean if end of input reached before first successful conversion or before matching failure occurs. how possible?
imagine you're trying read character file , you're @ end of file. end of input reached before successful conversion or matching attempt takes place.
second, not sure difference between read error , matching failure?
a read error means unable read data file
. matching failure means able read data didn't match expected (for example, reading a
%d
.)
Comments
Post a Comment