Re: Help. Where is my error?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Mon, 17 Oct 2005 19:53:34 GMT
"Red Dragon" <tskhoon@xxxxxxxxxxxx> writes:
> I am self study C student. I got stuck in the program below on quadratic
> equation and will be most grateful if someone could help me to unravel the
> mystery.
> Why does the computer refuse to execute my scanf ("%c",&q);
It doesn't. Your call to scanf("%c", &q) is doing exactly what it's
supposed to do.
To find out what it's supposed to do, read the documentation for
scanf().
You're almost certainly better off using a different method to read
input. A common technique is to use fgets() to read a line at a time,
then use sscanf() to parse the string. (This can have its own
drawbacks; fgets() either leaves the newline character in the input
string, or truncates the line if it's too long.)
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- Help. Where is my error?
- From: Red Dragon
- Help. Where is my error?
- Prev by Date: Re: how to form queues for data storage and how to Handle the matching of the Responses
- Next by Date: Re: Windows Programming in C under DevC++
- Previous by thread: Re: Help. Where is my error?
- Next by thread: Re: Help. Where is my error?
- Index(es):
Relevant Pages
|