How to Display Something on Screen with the C Programming puts() Function
When you’re programming in C, you may want your computer to display something on the screen. The puts() function sends a stream of text to the standard output device.
What the heck does that mean?
For now, consider that the puts() function displays text on the screen on a line by itself. Here’s the format:
#include <stdio.h> int puts(const char *s);
Because that official format looks confusing, you can also use this unofficial format:
The text part is a string of text — basically, anything sandwiched between the double quotes. It can also be a variable.
The puts() function requires that the source code include the stdio.h header file. That header file contains the function’s prototype. Header files are added to the source code by the use of the #include directive, as just shown.
The C language handles text in streams, which is probably different from the way you think computers normally handle text.
The standard output device is usually the computer’s display. Output can be redirected at the operating system level; for example, to a file or another device, such as a printer. That’s why the technical definition of the puts() function refers to standard output and not to the display.