gets(); collects a string of characters terminated by a new line from the standard input stream stdin #include <stdio.h> int main(void) { char string[80]; printf("Enter a string:"); gets(string); printf("The string input was: %s\n", string); return 0; } Output: Enter a string: IndiaBIX The string input was: IndiaBIX
Which of the following function is more appropriate for reading in a multi-word string?
Review the verified answer and explanation for this DemoPaper-Pakistan past-paper question on CampusFin.
Question context
This question is part of 💡 C Programming within the broader 💻 Programming subject and appears in the DemoPaper-Pakistan preparation collection. Reviewing the answer together with nearby questions helps reinforce the underlying concept and identify how it may appear in competitive exams.