Write a string followed by a newline to stdout.
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>.
| Name | Description | Optional |
|---|---|---|
str |
Pointer to the null-terminated string to write. | No |
puts("Hello, World!"); /* Outputs: Hello, World!\n */