Reference

function
<cstdio>

puts

int puts ( const char * str );
Write string to stdout
Writes the C string pointed by str to the standard output (stdout) and appends a newline character ('\n').

The function begins copying from the address specified (str) until it reaches the terminating null character ('0円'). This terminating null-character is not copied to the stream.

Notice that puts not only differs from fputs in that it uses stdout as destination, but it also appends a newline character at the end automatically (which fputs does not).

Parameters

str
C string to be printed.

Return Value

On success, a non-negative value is returned.
On error, the function returns EOF and sets the error indicator (ferror).

Example

1
2
3
4
5
6
7
8
/* puts example : hello world! */
#include <stdio.h>
int main ()
{
 char string [] = "Hello world!";
 puts (string);
}

See also

fputs
Write string to stream (function)
printf
Print formatted data to stdout (function)
putchar
Write character to stdout (function)
gets
Get string from stdin (function)

AltStyle によって変換されたページ (->オリジナル) /