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
What are conditional operators in C?
What is the newline escape sequence?
How is actual parameter different from the formal parameter?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
What is ambagious result in C? explain with an example.
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is this infamous null pointer, anyway?
What is malloc and calloc?
What are the types of data files?
What is the maximum no. of arguments that can be given in a command line in C.?
If fflush wont work, what can I use to flush input?
What is getch () for?
What is union in c?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
What is difference between Structure and Unions?