← All languages
C function of the day
Random

puts

Write a string followed by a newline to stdout.

Description

The puts() function writes the null-terminated string pointed to by str to the standard output stdout, followed by a newline character. The terminating null character is not written, but a newline is appended.

puts() returns a non-negative value on success, or EOF on error. It is a simpler alternative to printf() when no formatting is needed.

puts() is declared in <stdio.h>.

Arguments

NameDescriptionOptional
str Pointer to the null-terminated string to write. No

Example

puts("Hello, World!");  /* Outputs: Hello, World!\n */