Answers for "string text line"

C
0

string text line

#include <stdio.h>
//You can use the fgets() function to read a line of string. 
//you can use puts() to display the string.
//to solve spacing problem in scanf()
int main()
{
    char name[30];
    printf("Enter name: ");
    fgets(name, sizeof(name), stdin);  // read string
    printf("Name: ");
    puts(name);    // display string
    return 0;
}
Posted by: Guest on March-04-2022

Code answers related to "C"

Browse Popular Code Answers by Language