So I have a program that runs a loop in main to call functions to show all seats with their name and to reserve seats. My code works fine to reserve a seat. But when I reserve a second/third/fourth seat the name I enter for that seat overwrites the names for seats already reserved. Even if the seat is already occupied the name gets overwritten. Anyone know why?
char* name; //persons name
char seat; //the seat they want
char cr;
int row = 0; //the row they want
printf("Enter the seat and name like this: 4B, Jason Gills\n");
scanf("%d %c%c", &row, &seat, &cr);
gets(name);
if(SeatArray[row-2][seat-63].taken == 1)
{
printf("Seat %d%c is already taken. Please enter an available seat when making a reservation.\n", row, seat);
}
else
{
SeatArray[row-2][seat-63].name = name;
SeatArray[row-2][seat-63].taken = 1;
}