I'm having difficulties using strcmp
. I make a call in a separate else
statement (not listed), and it works fine. Is this a possible memory issue?
while(inHere == 1)
{
int numberOfOccupiedTables = 0;
cout << "\nSelect a table below\n---------------\n\n";
for(int i = 0; i < tables->size(); i++)
{
if(tables->at(i)->open == 0)
{
cout << "Table " << tables->at(i)->value << "\n";
numberOfOccupiedTables++;
}
}
if(numberOfOccupiedTables == 0)
cout << "No customers found.\n";
else
{
cout << "(q to back out) Enter number of table: ";
char* choice = (char*)malloc(sizeof(char)*256);
fgets(choice,256,stdin);
if(strcmp(choice, "q\n") == 0)
inHere = 0;
}