/* * assignment_question2.c - * Chapter5 * John Stile * Purpose: Write a program that includes a series of scanf function lines that * read input and store a single character, an integer, a float, and * a string into memory, then output all the data. */ #include int main(void) { char cc; // declare char int xx; // declare int float yy; // declare float char string[80]; // declare char array // // input section // printf("Input a char: "); // prompt for input scanf("%c", &cc); // store input at address of cc getchar(); // removes null from input buffer printf("Input an int: "); // prompt for input scanf(" %d", &xx); // store input ad address of xx, getchar(); // removes null from input buffer printf("Input a float: "); // prompt for input scanf("%f", &yy); // store input ad address of yy, getchar(); // removes null from input buffer printf("Input string of 80 chars or less (no spaces), followed by enter: "); scanf( "%s", string ); // store input in array string // // output section // printf("char: %c\n", cc); printf("int: %d\n", xx); printf("float: %f\n", yy); printf("string:%s\n", string); return 0; }