Reading a line of text Using standard library function

C Programming Language / String in C Language

847

Program:

/* 
 Author: Atnyla Developer
*/

#include<stdio.h>
int main()
{
    char line[30];
    
    printf("Enter name: ");
    gets(line);     //Function to read string from user.
    
    printf("Name: ");
    puts(line);    //Function to display string.
    return 0;
}

Output:

Enter name: Rambo Azmi
Name: Rambo Azmi
Press any key to continue . . .

Explanation:

To make life easier, there are predefined functions gets() and puts in C language to read and display string respectively.

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.