hi,
this is the code for switch:
include <stdio.h>
main()
{
int i=2;
switch(i)
{
case 1;
printf("i am in case 1\n");
break;
case 2;
printf("i am in case 2\n");
break;
case 3;
printf("i am in case 3\n");
break;
default;
printf("i am in default\n");
}
}
and this is the errors with:
[root@localhost lbin]# gcc -o l105 l105.c
l105.c: In function `main':
l105.c:8: error: parse error before ';' token
l105.c:11: error: parse error before ';' token
l105.c:14: error: parse error before ';' token
l105.c:17: error: parse error before ';' token
l105.c:9: warning: unreachable code at beginning of switch statement
plz help me.
:sad: