I have a program that defines a variable int data
The program uses scanf("%d",&data)
to read data from stdin.
If the data from stdin is not an integer, I have to print error message.
I tried if(scanf("%d",&data) ==EOF){ printf("error");return 1;}
It didn`t works for me. So, how can I determine if scanf failed or succeeded?