February 18, 2019

C Program to Print A String

The following is a C Program to Print a String on screen after taking input from user. Let's get started.

C Program to Print String
C Program to Print String

Overview:


Commands

scanf() function is used to obtain input and printf() function is used to print the string on the screen.

Program

#include<stdio.h>
int main()
{
/*variable definition and initialization*/     
    char stringArray[100];
    printf("Please write something: \n");
    scanf("%s",stringArray);
    printf("You entered the string %s\n",stringArray);
    return 0; 
}



Output

String Output
String Output


All programs compiled in this post are compiled online.

Books I Prefer:






I hope this article was helpful to understand C Program to Print a String! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.

0 Comments

Post a Comment

Avoid Spammy Comments