[ad_1]
so my compiler is telling me I have already used case 2 once, even though it’s inside another switch, So the problem is, my compiler is letting me use the case 1 again, but not case 2, Why is that?, I’ll show:
scanf("%d", &choice);
while (choice !=4){
switch (choice){
case 1:
printf("Enter a character: ");
scanf("\n%c", &item);
insert(&startPtr, item);
printList(startPtr);
break;
case 2:
if (!isEmpty(startPtr)){
printf("Enter character to be deleted: ");
scanf("\n%c", &item);
enqueue(&headPtr, &tailPtr, item);
if (delete(&startPtr, item)){
printf("%c deleted.\n", item);
printList(startPtr);
}
else
printf("List is empty or the element doesn´t exist.\n\n");
break;
case 3:
instructions2();
scanf("%d", choice2);
if (choice2 !=3){
switch(choice2)
case 1:
printQueue(headPtr);
break;
case 2:
delete2(headPtr);
break;
}
else
return 0;
break;
default:
printf("Invalid choice.\n\n");
instructions();
break;
}
}
printf("? ");
scanf("%d", &choice);
}
[ad_2]