totn C Functions

C Language: gets function
(Read String)

In the C Programming Language, the gets function reads characters from the stdin stream and stores them in s.

Syntax

The syntax for the gets function in the C Language is:

char *gets(char *s);

Parameters or Arguments

s
It is where the read characters will be stored.

Returns

The gets function returns s. The gets function will return a null pointer if an error occurs while trying to read stdin or the end of the stream is encountered before any characters are stored.

Required Header

In the C Language, the required header for the gets function is:

#include <stdio.h>

Applies To

In the C Language, the gets function can be used in the following versions:

  • ANSI/ISO 9899-1990

Similar Functions

Other C functions that are similar to the gets function:

See Also

Other C functions that are noteworthy when dealing with the gets function: