All pastes #981934 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-12 03:59 UTC
rendered paste body
// This is going to be a simple program that reads input from the user
// (First and last name) and then outputs them as a single string

#include <stdio.h>

main()
{

    unsigned short    length;   //declare integer for length (length in characers,
                                                    //including spaces
    char    first_name[20];  //variable for first name
    char    last_name[20];    //likewise for last name

    printf("Please enter your first name: ");      //read input from user (name)
    scanf("%s", first_name);
    printf("Please enter you last name: ");           // same as above; last name
    fflush(stdin);
    scanf("%s", last_name);
    strcat(first_name, " ");
    strcat(first_name, last_name);
    printf("You full name is '%s'\n", first_name);  // print concatenated strings
    length = strlen(first_name);
    printf("The length of your full name is '%d' characters\n", length);

    fflush(stdin);
    getchar();
}