puts() Library Function with Examples

puts() is unformatted string output functions. It writes or prints string to screen. It is defined in standard header file stdio.h.

puts() Syntax

puts(string or string_variable);

puts() Examples

Example #1 : Displaying String Using puts() Function


void main()
  char name[100];
  clrscr(); /* Clear the screen */
  printf(“Enter your name:\n”);
  puts(“Have a good day.”);
  getch(); /* Holding output */

Output of the above program :

Enter your name:
Ramesh Bhandari ↲
Ramesh Bhandari
Have a good day.

Note: ↲ indicates enter is pressed.