Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/classes/classdb.php on line 42
puts() - Write a String - I/O Function - C++ Tutorial

puts() - I/O Function

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


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.


int puts(const char *str);

Example :

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

Result :


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

C++ Tutorial

Ask Questions

Ask Question