Which of the following is used to receive a single string?
-
gets
-
getstring
-
Both A and B
-
None of the Above
A
Correct answer
Explanation
The gets() function in C reads a single line from stdin into a char array until a newline. Note that gets() is deprecated and dangerous because it doesn't check buffer boundaries, leading to buffer overflows. Use fgets() instead in production code. There is no standard C function called getstring().