I don't know which technique you are using for menu selection. I will give you the two way to select the menu.In these ways there is no problem as you mentioned.
Try this,
Code:
main ( int argc, char *argv[] )
{
int i;
while(1)
{
printf ( "Enter the value:" );
scanf("%d",&i);
switch(i)
{
case 0:
printf( "Valid\n");
break;
default:
printf("Default\n");
break;
}
}
}
Another way:
while(1)
{
printf ( "Enter the value:" );
scanf("%d",&i);
if(i==1) {
printf ( "Value is 1\n" );
}
else if(i==2) {
printf ( "Value is 2\n" );
}
else
break;
}
If my understanding is wrong , revert me back.