puts()

The puts(), or “put string”, function prints a string to stdout, normally the console, followed by a newline character.

Syntax

puts(str)

The puts() function takes a str argument and prints it, adding a newline character at the end of it.

Example

#include <stdio.h>
int main(void) {
puts("Hello World!");
return 0;
}

The output would be:

Hello World!

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn C on Codecademy

Contributors