So I was writing a quick program to get information about a patient from a hospital and it keeps skipping the scanf() at a certain point (at around line 34) and moves on to the scanf() after it. Here's the part that keeps bothering the life out of me:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
int main(void){
char choice_1, choice_2, *blood_group, *spec_conditions, *allergies;
printf("Enter the patient's medical details.\n\n");
printf("Enter your blood group: ");
scanf("%s",&blood_group);
printf("Does the patient have any allergies:(y/n)");
scanf("%c",&choice_2);
if (choice_2 == 'y'){
printf("Kindly enter the allergies: ");
scanf("%s",&allergies);
}else{
allergies = "No allergies";
}
printf("\nDoes the patient have any special conditions:(y/n)");
scanf("%c",&choice_1);
if (choice_1 == 'y'){
printf("Kindly enter the condtion: ");
scanf("%s",&spec_conditions);
}else{
spec_conditions = "No special conditions";
}
printf("Displaying details...\n");
sleep(2);
system("cls");
printf("\t\t\tPATIENT DETAILS\n");
sleep(1);
return 0;
}