Examveda

What is the purpose of the fgets function in C?

A. Read a file

B. Read a string from the console

C. Write to a file

D. Write to the console

Answer: Option B

Solution (By Examveda Team)

The purpose of the fgets function in C is to read a string from the console.

fgets reads a line of text from the specified input stream and stores it into the string pointed to by the provided pointer.

This function is often used to read input from the user via the console.

Therefore, fgets = read a string from the console.

This Question Belongs to C Program >> Arrays And Strings

Join The Discussion

Comments (1)

  1. SUSANTA SWAIN
    SUSANTA SWAIN:
    1 year ago

    please reconsider the answer

Related Questions on Arrays and Strings