hiii...
i running a program of C heres one function in which i am getting an error.
void snmp()
{
int count;
char switch_val;
printf(" start sending requests\n");
printf(" select '1' to send get request\n");
printf(" select '2' to send get next request");
scanf( "%d", switch_val);
switch(switch_val)
{
case '1':
count=0;
if (count==0)
{
get();
}
else getnext();
count++;
break;
case '2':
getnext();
break;
default:
printf("OOooPPppssss");
break;
}
}
program always go in default case. i can not figure it out why it is happeing. i have used switch statements manny times but on linux i have never worked before so could not debug the error properly.
if i use integer values for cases (for exmaple case '1')
then after selecting any option it gives 'segmentation fault' error.
plzzzz tell me whats wrong with this code....!!!