C Function Puts
# C Library Function - puts()
[ C Standard Library - ](#)
## Description
The C library function **int puts(const char *str)** writes a string to the standard output stdout until the null character, but not including the null character. A newline character is appended to the output.
## Declaration
Here is the declaration of the puts() function.
int puts(const char *str)
## Parameters
* **str** -- This is the C string to be written.
## Return Value
If successful, the function returns a non-negative value which is the length of the string (including the trailing ****). If an error occurs, it returns EOF.
## Example
The following example demonstrates the usage of the puts() function.
## Example
#include
#include
int main()
{
char str1;
char str2;
strcpy(str1,"TUTORIAL1");
strcpy(str2,"TUTORIAL2");
puts(str1);
puts(str2);
return(0);
}
Let us compile and run the above program, this will produce the following result:
TUTORIAL1 TUTORIAL2
[ C Standard Library - ](#)
YouTip