Solution for Exercise 12-11
ex1211
#include <stdio.h> int main() { char firstname[16],lastname[16]; printf("What is your first name? "); scanf("%s",firstname); printf("What is your last name? "); scanf("%s",lastname); printf("Pleased to meet you, %s %s\n",firstname,lastname); return(0); }
Notes
* The &
isn't required in the scanf() function when reading text into a char array.
* The output doesn't include the newline because scanf() stops reading the stream at any white space character.
Copyright © 1997-2024 by QPBC.
All rights reserved