#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
while(1)
{
scanf("%d", &a);
switch(a)
{
case 0;
break;
}
}
return 0;
}
If I have a loop and a switch inside it, I want to stop both of them. That's because a break just stops the switch. In the program, there is a loop that asks for a variable and then a switch case where if the variable is 0, the loop and the switch case must stop.
I tried to add a variable for the loop and change it in the case for stopping the loop, but it doesn't work.