The functionfgets() is used to read a string
The function puts() is used to display a string into standard output.
#include <stdio.h> int main() { char name[20]; printf("Enter name: "); fgets(name, sizeof(name), stdin); // read string printf("Name: "); puts(name); // display string return 0; }