how can i resolve "jump to case label" error here. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i resolve "jump to case label" error here.

https://code.sololearn.com/c0MP7n4r3J31/#c

24th Jan 2019, 8:53 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar
10 Answers
+ 4
This is a quirk of the c-language. It is not allowed to have a declaration like int num; directly after a case statement //not allowed case 2: int num; printf("\nYou Entered 2 :\nEnter any number to check whether it`s odd or even : "); //allowed case 2: printf("\nYou Entered 2 :\nEnter any number to check whether it`s odd or even : "); int num; //allowed and a very good practic use brackets!! case 2:{ int num; printf("\nYou Entered 2 :\nEnter any number to check whether it`s odd or even : "); } https://www.microchip.com/forums/m796314.aspx
24th Jan 2019, 9:47 PM
sneeze
sneeze - avatar
24th Jan 2019, 9:33 PM
John Wells
John Wells - avatar
+ 3
I don't get any errors running it. However, I'm did not attempt to enter any data to run it correctly just hit submit at the prompt.
26th Jan 2019, 5:24 PM
John Wells
John Wells - avatar
+ 3
It worked fine. I entered the following lines for 4 different runs: 3 5 6 + 3 5 6 - 3 5 6 * 3 5 6 / Got 11, -1, 30, and 0 as answers all what I expected.
26th Jan 2019, 9:16 PM
John Wells
John Wells - avatar
+ 1
hey sneeze can you check the third case of outer switch why it's not giving the correct answer?
26th Jan 2019, 4:29 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar
+ 1
Can you correct the outer switch third case?
26th Jan 2019, 8:46 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar
+ 1
@abdul Have a look. https://code.sololearn.com/cxX0ZSbC2sWB There are a lot of small bugs in your code. I added what I did in the comments Please read the compiler messages carefully, when trying to solve bugs. The contain the line number, the bug is on. And most of the time usefull information about the problem on that line. Use brackets to make your code more readable and less buggy. Please notice that in case 2 : The equation is not the way to check for even and odd
26th Jan 2019, 9:33 PM
sneeze
sneeze - avatar
+ 1
@Abdul Have a look at this code. In this code the problem of the third case is solved. https://code.sololearn.com/cxX0ZSbC2sWB Please let me know if you do not agree.
14th Feb 2019, 8:54 PM
sneeze
sneeze - avatar
+ 1
Thanks alot sneeze
15th Feb 2019, 8:20 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar
0
Sir (John Wells) the code you updated for me still shows the same error...
26th Jan 2019, 4:22 PM
Abdul Bari Abbasi
Abdul Bari Abbasi - avatar