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


Please Help Members By Posting Answers For Below Questions

What is the significance of scope resolution operator?

865


How to draw the flowchart for structure programs?

8764


Is c still relevant?

646


Function calling procedures? and their differences? Why should one go for Call by Reference?

639


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

651






Does c have class?

615


What does void main return?

610


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7413


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

668


What are operators in c?

586


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1123


Which is better oop or procedural?

636


What are comments and how do you insert it in a C program?

746


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

610


why return type of main is not necessary in linux

1708