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
Print the user input i.e. string through
char CharArr; //declare character array of size 10 bytes
printf("\n provide input string:");
scanf("\n%s",CharArr); // read input from user into Character array
printf(" inputString = %s\n",CharArr); //print output to screen
provide input string:cprograms
inputString = cprograms
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.