Error: Jump to case label in switch statement

I wrote a program which involves use of switch statements, however on compilation it shows:

Error: Jump to case label.

Why does it do that?

#include <iostream>
int main() 
{
    int choice;
    std::cin >> choice;
    switch(choice)
    {
      case 1:
        int i=0;
        break;
      case 2: // error here 
    }
}

4 Answers
4

Leave a Comment