Having trouble with an if statement!
This program is part of a large one and accessed via a switch statement. For some reason when I type in a Y or N at the prompt when running it, the program skips to the last else option and replies a 'not a valid option' when it should not. I have messed with it for ages and am not getting anywhere.
char choice1 = 'Z';
k = 5 - j;
printf("\nThere are currently %i spaces in the data base", k);
printf("\n\nEnter the Student's first name:\t\t ");
printf("\ndatabase. Please conform that these details are correct (Y/N)");
choice1 = getchar();
k = 0;
if (choice1 == 'Y')
printf("\n1 student record saved to file\n");
if (choice1 == 'N')
printf("Not a valid option");