C program to print a string

In this program, we will see how to print user provided string in c. There are multiple methods that can be implemented to write this program. We will take user provided input here that can be word or sentence and then print it on screen.


Input output functions, string, pre-defined methods


First take the user input through command prompt and then store it inside character array i.e. string in c

Use scanf() function to read the data into character array and specify format specifier %s to accept string data i.e. word, set of characters

Print the user input i.e. string through printf() function and use %s to format data output as string in printf() function



We have already discussed this method where a string is printed to console screen character by character. Check out the program for printing string character by character.

1 thought on “C program to print a string”

Leave a Reply

%d bloggers like this: