What is the difference between GETS();AND SCANF();
Answer Posted / vignesh1988i
the main difference between gets() and scanf() function is that while getting any input as a stream of characters or as a string using scanf() , the end termination character is a blank space or an enter key for scanf() , so upto blank space it will be saving it in the memory...... SHORTLY it ignores the characters comin after and with blank spaces........
in gets() , it allows with the blank spaces and the termination condition is a enter key (\n) ,
but a inside gets() function , surely they would have used scanf() function , but the difference is that the input inside gets() would go character by character , so only gets() can allow with the blank spaces...........
thank u
| Is This Answer Correct ? | 103 Yes | 47 No |
Post New Answer View All Answers
Tell me is null always defined as 0(zero)?
Why is it important to memset a variable, immediately after allocating memory to it ?
What is #line in c?
How can a program be made to print the line number where an error occurs?
What is scope and lifetime of a variable in c?
Tell me what are bitwise shift operators?
What is an auto keyword in c?
Explain what is output redirection?
How can I read data from data files with particular formats?
What is the use of getchar functions?
What are the types of arrays in c?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
What is storage class?
Why doesnt the call scanf work?
Why calloc is better than malloc?