Answer to Question #209456 in C for Pragadeesh

Question #209456

Write a C program for File Operations to read a string from standard input and prints the entered string using fgets() and fputs() function.


1
Expert's answer
2021-06-22T02:37:24-0400
#include<stdio.h>
int main()
{
   char entered_sentence[200];
   fputs("Enter a string: ", stdout); // Demostrating the fputs() is used to print
   
   fgets(entered_sentence, sizeof(entered_sentence), stdin); //Illustrating how the fgets() function reads the input from the standard input
    fputs(entered_sentence, stdout); //Printing the string entered by the user.
   //printf("The entered string: %s",str);
   return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS