Check out example codes for "case label in c++". It will help you in understanding the concepts better.

Code Example 1

switch(foo) {
  case 1:
    int i = 42; // i exists all the way to the end of the switch
    dostuff(i);
    break;
  case 2:
    dostuff(i*2); // i is *also* in scope here, but is not initialized!
}

Learn ReactJs, React Native from akashmittal.com