Write a Modular C Programming Code for Read & Display Strings | Sentence?
CODE:
#include<stdio.h> #include<string.h> void read_sentence(char sentence[]); void display_sentence(char sentence[]); main() { char sentence[200]; printf("Enter the sentence:\n"); read_sentence(sentence); display_sentence(sentence); } void read_sentence(char sentence[]) { gets(sentence); } void display_sentence(char sentence[]) { printf("\nThe given sentence is: "); puts(sentence); }
OUTPUT
Enter the sentence: Facts Prime gives you the #1 Resources of all the things. The given sentence is: Facts Prime gives you the #1 Resources of all the things. Process returned 0 (0x0) execution time : 13.844 s Press any key to continue.,
Please find some more codes of 1D Arrays, 2D Arrays, Pointers on the below page:
Top 100+ C Programming codes – KLE Technological University