home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.os2.programmer
- Path: sparky!uunet!kithrup!stanford.edu!ames!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!orstnews!ucs.orst.edu!hilmera
- From: hilmera@ucs.orst.edu (Andrew Hilmer)
- Subject: Question and problem with GCC/2
- Message-ID: <1992Aug19.212328.15304@talon.ucs.orst.edu>
- Sender: usenet@talon.ucs.orst.edu (Usenet News admin)
- Nntp-Posting-Host: ucs.orst.edu
- Organization: University Computing Services - OSU
- Date: Wed, 19 Aug 1992 21:23:28 GMT
- Lines: 64
-
- Compiler: gcc/2 2.1
- Problem: problem and question about gcc/2
-
- First the question. I have no trouble compiling and linking the
- sample1.c "hello world" program, but I am curious about the multiple
- prompts that link386 gave me. I just hit <enter> and the defaults
- seemed to work ok. I could find no on-line documentation of link386,
- of course. Is there some documentation of link386 available on the
- net? I am FLAT broke, so getting a shelf-full of IBM docs is not an
- option.
-
- Now the problem. While the sample1.c file worked fine, a simple
- programming assignment performed bizarrely after compiled and linked.
-
- 88888888888888888888888888888888888888888888888888888888
-
- /*
- This program takes the input of two numbers, one
- integer, one floating point, and prints them back out.
- */
-
- #include <stdio.h>
-
- main()
- {
- int x;
- float y;
-
- /* fflush(stdin); */
- printf("This is my first C program.\n");
- printf("Enter an integer: ");
- scanf("%d", &x);
- printf("Enter a floating point number: ");
- scanf("%f", &y);
- printf("The value stored in x is %d\n", x);
- printf("The value stored in y is %f\n", y);
- }
-
- 88888888888888888888888888888888888888888888888888888888
-
- When run, it prints nothing but a line or two and a blinking cursor.
- As a shot in the dark, I entered 3, hit enter (got another big
- nothing), then entered 93.9 and hit enter.
-
- It printed:
-
- This is my first C program.
- Enter an integer: Enter a floating point number: The value stored in x is 3
- The value stored in y is 93.900002
-
- WHY the F**K does it do what is supposed to be executed FIRST, LAST????.
- It worked fine with EMX/GCC, GCC for Unix, and I didn't have to do
- anything fundamental to get it work with Think C on the mac. Hell, I
- basically just typed in what the teacher said to type in.
-
- Don't worry, I used EMX for the class. But now that I have a lot of
- time on my hands, I want to track this strangeness down.
-
- Thanks
-
- andy
- --
- hilmera@ucs.orst.edu Why settle for the *lesser* of evils? Cthulu 92!
-
-