C puts() Function : C Reference



Puts >> Displaying String in C Programming :
Way 1 :Messaging

puts(" Type your Message / Instruction ");
  • Like Printf Statement puts() can be used to display message.

Way 2 : Display String

puts(string_Variable_name) ;

Notes or Facts :

  1. puts is included in header file “stdio.h”
  2. As name suggest it used for Printing or Displaying Messages or Instructions

Uses :

  1. Printing Message
  2. Ask user for entering the data ( Labels . Instructions )
  3. Printing Results

Live Example :

#include< stdio.h>
#include< conio.h>
void main()
  {
   char string[] = "This is an example string\n";
   puts(string);     // String is variable Here
   puts("String");   // String is in Double Quotes
   getch();
}

Output :

String is : This is an example string
String is : String

Related Articles :

  1. How to Input Password in C : Validation of User name
  2. Putchar function >> Displaying String in C
  3. Puts >> Displaying String in C Programming
  4. Printf >> Displaying String in C Programming