i know that it returns the number of variable that it inputed correctly by its format.
but i want that if it will input 3 variables correctly and the 4th is wrong
then it will return 3.
so i dont know if the input is wrong or not
??
i know that it returns the number of variable that it inputed correctly by its format.
but i want that if it will input 3 variables correctly and the 4th is wrong
then it will return 3.
so i dont know if the input is wrong or not
??
I don't read any difference therei know that it returns the number of variable that it inputed correctly by its format.
but i want that if it will input 3 variables correctly and the 4th is wrong
then it will return 3.
So you're saying that scanf works exactly the way you want it to. What exactly is the question?
my question is how to know by the return value of scanf
if it failed or not
??
I think they want to know:if somehow a gets filled, and c gets filled, but not b, and it returns 2, which ones are valid and which ones aren't.Code:x = scanf("%d %f %s", &a, &b, c );
That's my guess at what they're asking. In which case, the answer would be: It wouldn't. It would return 1 instead of 2, because it would stop matching scan patterns once it fails to match one of them.
Quzah.
Hope is the first step on the road to disappointment.