+ 1
how can i resolve "jump to case label" error here.
10 Antworten
+ 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
+ 3
This compiles:
https://code.sololearn.com/cDaV1yZSuh2I
+ 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.
+ 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.
+ 1
hey sneeze can you check the third case of outer switch why it's not giving the correct answer?
+ 1
Can you correct the outer switch third case?
+ 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
+ 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.
+ 1
Thanks alot sneeze
0
Sir (John Wells) the code you updated for me still shows the same error...