Solution for Exercise 12-12

ex1212

#include <stdio.h>

int main()
{
    char firstname[16],lastname[16];

    printf("What is your first name? ");
    scanf("%15s",firstname);
    printf("What is your last name? ");
    scanf("%15s",lastname);
    printf("Pleased to meet you, %s %s\n",firstname,lastname);
    return(0);
}

Notes

* Because scanf() terminates input at the first white space character, it won't read a first or last name that contains a space. That's one of the limitations of using scanf() for text input.