Siddhartha Basu
Wed, 12 Feb 2003 08:26:27 -0800
Hi, Try to avoid scanf function as much as possible, instead use fgets and sscanf combo for stdio which has got much more efficient error checking. This is most recommended procedure as i have found in comp.lang.c group. For a much better explanation follow this link. http://www.eskimo.com/~scs/C-faq/s12.html
Check out question no 12.12 and 12.20
bye
siddhartha
--- Manas Laha <[EMAIL PROTECTED]> wrote: >
Soumyadip Modak wrote:
>
> > #include <stdio.h>
> >
> > int main()
> > {
> > float celsius, fahrenht;
> >
> > printf("Enter temp. in Celsius:");
> > scanf("%f",celsius); <--- ERROR here!
> scanf( "%f", &celsius ); <--- Should be
> like this
> > fahrenht=(9*celsius/5)+32;
> > printf("Fahrenheit temp.
> is:%.3f",fahrenht);
> > }
> >
>
> I'm right now not on the machine that has the gcc3.2
> compiler, but
> compiling this program with gcc2.91 shows a syntax
> error in the line
> that says "scanf .... ". Obviously, "celsius" should
> be "&celsius". I
> wonder why the compiler on your machine didn't
> signal this error at
<snipped>
________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
visit http://in.tv.yahoo.com
--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3