Computer Science, asked by Deepak28581, 10 months ago

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

Answers

Answered by YagyaDuggal
1

Answer:

Which of the following function is more appropriate for reading in a multi-word string? For scanf you need to write the loop for terminating input action, so better is use gets() method. of course get(); command. This get(); keyword is pre assigned in c language to scan string data given by user.

Answered by rihuu95
0

Answer:

The correct answer to the question-"Which of the following function is more appropriate for reading in a multi word string" is-

Function gets()

Explanation:

Function gets()

The function gets() is used for collecting a string of characters terminated by new line from the standard input stream stdin.

Therefore gets() is more appropriate for reading a multi-word string.

Although ,we cannot use  gets() in C++  as in C++ headers are called <iostream>, <conio>, <stdio> and <string>. gets() , is the one function that is so incredibly broken by design that it was actually removed from newer versions of the C standard.

Use of gets () function-

  • The gets() function provides no support to prevent buffer overflow if large input string are provided.
  • The gets() function reads characters from stdin and stores them in str until a newline character or end of file is found.
  • The difference between gets() and fgets() is that gets() uses stdin stream.
Similar questions