Pointer to a null-terminated string to be written to the standard output (`stdout`).
Read more about parameters of puts in parameters section
The putsfunction in C language Writes a string followed by a newline to the standard output stream.
The puts function writes the string pointed to by str to the standard output stream (stdout) and appends a newline character. It's often used for simple string output when a newline is desired after the string. Unlike printf, puts automatically adds a newline, which can be convenient but also needs to be considered when formatting output.
The putsfunction takes 1
parameter:
•
const char * `str`: Pointer to a null-terminated string to be written to the standard output (`stdout`).
Writes the string `str` followed by a newline character to the standard output (`stdout`). Returns a non-negative value on success or `EOF` if an error occurs. The function automatically appends a newline after the string.
The puts function return value :
Returns a non-negative value on success, or EOF on error
Output
This example demonstrates the basic use of puts to output a string. It also includes error checking.