Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   help with scanf(); (http://www.go4expert.com/forums/help-with-scanf-t21479/)

lionaneesh 24Mar2010 11:58

help with scanf();

tell me the logic of this scanf statement and why " [^\n] " is used instead of %s ...
and how this statement works...

i know that this statement inputs lines till enter is pressed..

but what is the format of the scanf statements please tell...

karthigayan 24Mar2010 12:23

Re: help with scanf();
It is equal to gets . By default scanf will read the input until it receives a word separator ( space,tab,etc ).

We can change that to some character . Here you changed to read until the new line ( Read the characters other than '\n' .If '\n' it will get end ) .

All times are GMT +5.5. The time now is 19:22.