Which of these functions is safer to use : fgets(), gets()? Why?
Answer / Gaurav Mishra
fgets() is safer to use compared to gets(). The primary reason is that fgets() allows you to specify the maximum number of characters to read, preventing potential buffer overflows. On the other hand, gets() reads an entire line from stdin without a size limit, which can result in unintended consequences when used improperly.
| Is This Answer Correct ? | 0 Yes | 0 No |
what is the output of the following program? #include<stdio.h> void main() { float x=1.1; while(x==1.1) { printf("\n%f",x); x=x-0.1; } }
Explain how do you use a pointer to a function?
What is difference between structure and union?
what is the c source code for the below output? 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1
how does the C compiler interpret the following two statements p=p+x; q=q+y; a. p=p+x; q=q+y b. p=p+xq=q+y c. p=p+xq; q=q+y d. p=p+x/q=q+y
What is an lvalue and an rvalue?
How does placing some code lines between the comment symbol help in debugging the code?
What is false about the following A compound statement is a.A set of simple statments b.Demarcated on either side by curly brackets c.Can be used in place of simple statement d.A C function is not a compound statement.
How do you list a file’s date and time?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it.
the maximum width of a c variable name can be a) 6 characters b) 8 characters c) 10 characters d) 20 characters
What is #include in c?