For some reason it wont compile and I get the error messages (in the goto line) below
Linetest.c:40: error: expected identifier or ‘*’ before ‘case’
Linetest.c:44: error: expected identifier or ‘*’ before ‘case’
Linetest.c:48: error: expected identifier or ‘*’ before ‘case’
Ive got no idea why it wont compile :s Any help please, thanks!
Code:
#include <stdio.h>
int numval;
int main()
{
numval = 4;
printf("\n Numval = %d \n", numval);
switch (numval)
{
case 0 : {printf("\n Case 0 = %d \n\n", numval);} break;
case 4 : {
printf("\n Case 4 = %d \n\n", numval);
} break;
case 8: {
printf("\n Case 8 = %d \n\n", numval);
} break;
case 12: {
printf("\n Case 12 = %d \n", numval);
printf("\n Both Motors Forward \n");
if (numval != 4)
{
goto case 8;
}
if (numval != 8)
{
goto case 4;
}
if (numval = 12)
{
goto case 12;
}
} break;
default: {printf("\n Default = %d \n\n", numval);} break;
}
return 0;
}