C Program to Print String

cprogramming-Logo
C Programming Examples
C String Programs
C Loop Programs
C Function Programs
C Array Programs
C Integer Number Programs
C File I/O Programs

This C program is used to print a string on the screen input by the user.

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

Program:
#include<stdio.h>

void main()
{
    //variable definition and initialization
    char stringArray[100];

    printf("Please write something: \n");
    scanf("%s", stringArray);
    
    printf("You enter the string %s\n", stringArray);
}
Program Output:

print-string

Scroll Back to Top