I have a functionality where user will be prompted to choose one of the three options.
1. for insert
2. for delete
0. for quit
I have a infinite for loop which will continuously ask user to do something. If user choose 0, I want the infinite loop to break. I cannot figure out how to break a for loop inside switch case.
for(;;){
printf("please enter :\n");
printf("1 for INSERT\n");
printf("2 for DELETE\n");
printf("0 for quit\n");
printf("what's your value ?\n");
scanf("%d",&operation);
switch(operation){
case 1:
printf("you choose to INSERT. Please inter a value to insert\n");
scanf("%d",&value);
insertAtBeginning(value);
break;
case 2:
printf("you choose to DELETE\n");
deleteFromBeginning();
break;
case 0:
break;
}
}