Wednesday 25 November 2015

Program which inputs string and print it, using library function 'gets()'.

//Program which inputs a string and print it, using library function 'gets()'.

#include<stdio.h> // to load standard input output library
#include<conio.h> // to load console input output library

void main() // execution of any program starts from here
{
      char str[100]; // an array of 'char' type having 100 as its size
clrscr(); // used to clear the console screen

      printf("Enter a string: \n"); // function prints 'Enter a string' on the console screen
      gets(str); // function which inputs strings having spaces between them

      printf("String entered: %s",str); // function prints the strings entered by user
      getch(); // to hold the output screen
}

No comments:

Post a Comment