View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12933 Members
Join this group to post and comment.
lit-857
lit-857 • Apr 12, 2013

What is - while(scanf("%d %d",&n,&m)!=EOF) ?

wts EOF AND IS SCANF returen values?
Whats In Name
Whats In Name • Apr 12, 2013
scanf returns the number of items assigned,EOF means end-of-file and has value -1,so this statement probably means run the loop 2 times.

*Please correct me,if I am wrong
rahul69
rahul69 • Apr 12, 2013
lit-857
wts EOF AND IS SCANF returen values?
This statement simply means keep on scanning the values of m and n until End of File is reached.
Scanf returns number of variables scanned normally but it returns EOF if End of File is reached before variables could be scanned.😀
Prateek Gupta
Prateek Gupta • Apr 18, 2013
scanf :- used to scan the values.
EOF:- indicates the End Of File.
!= :- relational operator (not equal to)
this can be understood like this :-
keep scanning the values in variables n and m from the file until EOF has not been found.

Share this content on your social channels -