Question: /* What is wrong with the following C code? It compiles, but it has a logic error. It seems to me that it is not

/* What is wrong with the following C code? It compiles, but it has a logic error. It seems to me that it is not taking the initials correctly (Assume that this is a code snippet inside of a correctly formatted main function) */

int year;

char first, middle, last;

printf("Enter the current year and press return: ");

scanf("%d", &year);

printf("Type in 3 initials and press return: ");

scanf("%c%c%c", &first, &middle, &last);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!