C programming puts stdio.h


In C programming the <stdio.h> puts function writes the string to the console and append a new-line character to the output.The NULL terminating character is not written.The declaration of the function is given below.

int puts(const char *s);

Parameters:
s -A pointer to string to be written to the output.

Return type
int -Returns EOF if a write error occurs;otherwise it returns a non negative value.

A code example is given below.

Code example

char str[ ]=”Writing string to console”;

int ret ;

ret=puts( str );
printf(“\n%d” , ret);

Output

Writing string to console
0


Related links

->C fputs stdio.h

->C putc stdio.h