so i wrote this code fragment and when scan a input not a integer the code never stop printing
"illegal input please try again" !!!!! nothing wrong with code :S any help
Code:
int x,y;
int deminsions_check()
{
int f;
f=scanf("%d%d",&x,&y);
if(f==0)
{
printf("illegal input please try again\n");
return 1;
}
else if(x>9|| y>9 || x<3 || y<3)
{
printf("illegal board deminsions please try again\n");
return 1;
}
else
return 0;
}
int main()
{
int u;
printf("hello to the tic tac toe game !! ;)\n");
printf("please enter demensions as rows and columns\n");
u=deminsions_check();
while(u==1)
{
u=deminsions_check();
}
return 0;
}