Is there any way to pass a value to outside of a switch?

For instance, i want to pass the int a from case1 to outside of the switch statement

1
2
3
4
5
6
7
8
9
10
for(;;){
do{
  switch(XX){
case1: int a;
case2:
default:
}
(can i get the value a at here?)
}while(!=NN)
}
Last edited on
You will have to declare the variable outside the the switch.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
for(;;)
{
  do
  {
    int a;
    switch(XX)
    {
       case1:  // do something here with 'a'
       case2:
       default:
    }
    // do something here with 'a')
  }while(!=NN)
}
Last edited on
ty bro
Topic archived. No new replies allowed.