C puts() function
C library function - puts()
The puts() function is used to write specified string (plus a newline), to the standard output stream. The ending null character is not written.
Syntax:
int puts(const char *str)
Parameters:
| Name | Description | Required /Optional | 
|---|---|---|
| str | This is the string to be written. | Required | 
Return value
- Upon successful completion, puts() shall return a non-negative number.
 - Otherwise, it shall return EOF, shall set an error indicator for the stream, and errno shall be set to indicate the error.
 
Example: puts() function
#include <stdio.h>
int main() 
{
    const char *text = "C Programming.";
    puts(text);
    return 0;
}
Output:
C Programming.
Difference from printf()
- The puts() function prints a newline after the text supplied.
 - The puts() function prints the string as it is (% codes are not processed).
 
C Programming Code Editor:
 Previous C Programming:  C putchar() 
  Next C Programming: C perror()
