-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathputs() function.cpp
More file actions
29 lines (21 loc) · 872 Bytes
/
puts() function.cpp
File metadata and controls
29 lines (21 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Demonstrate puts() function with examples
#include<iostream>
#include <cstdio>
int main()
{
char str[] = "Programming can be fun!";
puts(str);
puts(str);
return 0;
}
/*In C++, input/output operations can be performed by using C standard libraries.
These are defined inside the cstdio.h header file in C++. Full form of cstdio is C Standard Input and Output library.
Syntax of puts():-
int puts ( const char * str );
In simple words, you can use this function to print a string to the user.
It takes one argument str, which is a C string pointer. It writes this str to stdout.
Note that it adds one newline character ‘\n’ after writing the string.
This function is defined in cstdio.h file and we need to import it at the beginning of the program.
Return value:-
On success, it returns one non-negative value and on error, it returns EOF.
*/