
BUT! add a random statement before:

Any thoughts?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This isn’t a switch-statement bug, it’s a limitation in the C language. In C, the first statement after a case label cannot be a variable declaration. You can get around this by either declaring the variables before the switch statement or creating the variable inside a block of code (see below). Obviously, you can also re-order your code (if possible) so that another statement comes before the variable declaration.
Example 1:
Example 2:
Example 3: