scanf() to read a string

C Programming Language / String in C Language

901

Program:

/* 
 
Author: Atnyla Developer

*/

#include<stdio.h>
int main()
{
    char name[20];
    printf("Enter Your name: ");
    scanf("%s", name);
    printf("Your name is %s.", name);
    return 0;
}

Output:

Enter Your name: Rambo Azmi
Your name is Rambo. 

Explanation:

This C program illustrates how to read string from terminal.

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.