Soumyadip Modak
Wed, 12 Feb 2003 08:35:45 -0800
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Yep u got it. It's that pesky &. I don't like scanf, but the lab instructors insist on it :(
Soumyadip Modak RCC Institute of Information Technology Kolkata, India > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Manas Laha > Sent: Wednesday, February 12, 2003 3:42 PM > To: [EMAIL PROTECTED] > Subject: Re: [ilug-cal] [OT]Problems with gcc > > > 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 compile time. > Naturally this will cause a "segmentation violation" error at > runtime. I must try this out with gcc3.2! This promises to be > interesting. > > - Manas Laha > > -- > 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 > -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com> iQA/AwUBPkpljAAMO//EcNNiEQI1FwCgpufGdhTZFIUJECQr09u0dxUg6OcAn2uT ahpjc4iByBK8Ko1WozBtYvr8 =lKnx -----END PGP SIGNATURE----- -- 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