puts() - I/O Function

How is "puts()" used in C++?

Explanation

puts() is an I/O function that is used to write a string to the standard output. This function returns a non negative value upon if successfull and returns EOF otherwise.

Syntax:


int puts(const char *str);

Example :



#include <stdio.h>
int main ()
{
char str [] = "ABCD";
puts (str);
}

Result :

ABCD

In the above example puts() is used to write the string of an array to the standard output.

C++ Tutorial


Ask Questions

Ask Question