Re: how to check the scanf function if it will read more than one number




Richard Heathfield wrote:

> For the same reason that pressing the handle on your toilet will not get rid
> of the water waiting in your sink's tap (or faucet, if you're on that side
> of the pond). Flushing is something we do to output, not to input.

thanks.
but what I want to know is the "actual" reason,
not a "logical" one.
e.g.
void f( int*p )
{
if (p->num)
do something;
}
when this function is running, there will be an error.
if I don't know the reason,what I want to know is :
if p is a NULL pointer, p->num will cause the error.

so ,the fflush function works very well on my computer now,
If it cause a potential danger,
I want to know what is it, and what is the condition.
if possible, an example is the best. :)

thanks for all !

.