The C language has three standard library functions that are bold to output strings puts () fputs () printf ()
The use of the puts () function is simple and requires only the address of the string parameter. Note that each string is displayed in a single line, and unlike printf (), puts () automatically adds a newline character after the string is displayed.
/* put_out.c-using puts ()/#include <stdio.h> #define DEF "I am a #defined string." int main (void) {char str1[ [] = "An array is initialized to me." const char * str2 = "A pointer is initialized to me." Puts ("I ' m an argument to puts ()"); Puts (DEF); Puts (STR1); Puts (STR2); Puts (&str1[5]); Puts (str2+4); return 0; }
Run results
I ' m an argument to puts ().
I am a #defined string.
An array is initialized to me.
A pointer is initialized to me.
Ray is initialized to me.
Inter is initialized to me.
Fputs ()---is a file-oriented version of Gets ()
Define function fputs (const char *s, FILE *stream)
The return value succeeds returns the number of characters written, and the return EOF indicates an error occurred
Used to write the string that the argument s refers to in the file that the parameter stream refers to.
Format output for printf ()---string