C Language: puts function(Write String)

In the C Programming Language, the puts function writes a string (and then a new-line characters) to the stdout stream.


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

int puts(const char *s);

Parameters or Arguments


The string to write to stdout.


The puts function returns a nonnegative value if successful. If an error occurs trying to write to stdout, the puts function will return EOF.

Required Header

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

#include <stdio.h>

Applies To

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

  • ANSI/ISO 9899-1990

stdio.h Functions