Knowee
Questions
Features
Study Tools

Which of the following function is more appropriate for reading in a multi-word string? gets() puts() scanf() printf()

Question

Which of the following function is more appropriate for reading in a multi-word string? gets()

puts()

scanf()

printf()

🧐 Not the exact question you are looking for?Go ask a question

Solution

The most appropriate function for reading in a multi-word string is gets().

Here's why:

  1. gets() function: This function is used to read a line from the standard input (keyboard) until a newline character or the end of the file. It can read multi-word strings because it does not stop reading input after encountering a space.

  2. puts() function: This function is used to write a string to the standard output (screen). It's not used for reading strings.

  3. scanf() function: This function is used to read formatted input from the standard input. However, it stops reading input as soon as it encounters a space, so it's not suitable for reading multi-word strings.

  4. printf() function: This function is used to write formatted output to the standard output. Like puts(), it's not used for reading strings.

So, gets() is the most appropriate function for reading in a multi-word string.

This problem has been solved

Similar Questions

Which of the following function is more appropriate for reading in a multi-word string?ans.puts()scanf()gets()printf() Previous Marked for Review Next

StringsWhich of the given function is more appropriate for reading in a multi-word string including spaces?Optionsscanf()gets()getchar()puts()

Which of the following function is more appropriate for reading in a multi-word string?

Which of the following function is more appropriate for reading in a multi-word string in c?

function is more appropriate for reading in a multi-word string?ans.

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.