im trying to make C calculator app. That means there is input "x + y =" and i need to calculate the result. My problem is when user input for example "6 + 4". That means there is missing equals sign. But the program is waiting for more data. How to block scanf waiting for more data after pressing enter and just say that this input was wrong?
double x,y;
char c; //this desires if its plus, minus ...
if(scanf("%lf %c %lf =",&x,&c,&y)!=3)
{
printf("wrong input\n");
return 1;
}