I am pretty new to C programming and this is a homework assignment.
I do not understand why my program will not exit. I looked at a previous program I wrote for this same class and it literally looks the exact same but the old one works and this one does not. Here is my code. Everything except the quit works. Whenever I choose option 4 for quit I get the default statement for some reason and then it loops and shows the menu over and over again.
Thank you for any help!
int selection, num;
printf("Cannot add another value. It is already full\n");
printf("Please enter the number you would like to add\n");
printf("Cannot remove a value. There are none to remove.\n");
num = pop(&top);
printf("%d has been removed from the stack\n", num);
printf("There is nothing to print\n");
quit = TRUE;
printf("Error: that is not a valid selection. Please try again.\n");
printf("Have a nice day!");
printf("Please select from one of the following options:\n");
printf("1. Push\n2. Pop\n3. Print\n4. Quit\n\n");
printf("Please enter your selection ");