by Dinesh Thakur Category: C Programming (Pratical)

 

#include <stdio.h>
#include <string.h>
char first[100];  /* First name of person we are working with */
char last[100];  /* His last name */
                      /* First and last name of the person (computed) */
char full[200];         
int main()
{
    clrscr();
    printf("Enter First Name : ");
    fgets(first, sizeof(first), stdin);
    printf("Enter Last Name : ");
    fgets(last, sizeof(last), stdin);
    strcpy(full, first);
    strcat(full, " ");
    strcat(full, last);
    printf("The Name is %s", full);
    getch();
    return (0);
}

Multiple fgets Function



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.