home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.apple2.gno
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!mp.cs.niu.edu!uxa.ecn.bgu.edu!news.ils.nwu.edu!aristotle.ils.nwu.edu!chauhan
- From: chauhan@aristotle.ils.nwu.edu (Amrit Chauhan)
- Subject: Crash............
- Message-ID: <1992Nov16.073159.14009@ils.nwu.edu>
- Sender: usenet@ils.nwu.edu (Mr. usenet)
- Nntp-Posting-Host: aristotle.ils.nwu.edu
- Organization: The Institute for the Learning Sciences
- X-Newsreader: Tin 1.1 PL5
- Date: Mon, 16 Nov 1992 07:31:59 GMT
- Lines: 62
-
- I am in the process of learning C, and obviously, I have some really dinky C
- programs. Well, this one crashes...in very weird ways. Take a look:
-
- -- cut here --
-
- /* prob8.c -- Programming Exercises (Chapter VI, Problem 8) */
- #include <stdio.h>
- #define MAX 7
- main()
- {
- int i, integers[MAX];
-
- printf("Please enter 8 integer values below:\n");
-
- for(i = 0; i <= MAX; i++)
- scanf("%d", &integers[i]);
- printf("Right back at you...\n");
-
- for(i = MAX; i >= 0; i--)
- printf("%d ", integers[i]);
- printf("\n");
- }
-
-
- -- cut here --
-
- Ok...this program simply inputs eight integers and then prints them back out
- in reverse order....like I said, not on the order of your typical GNO program
- :) But, it still crashes.....
-
- I put this through Splat!(tm) and when it finished (it actually runs all the
- way through with no problems) Splat!(tm) printer something like:
-
- "Splat! requires Byteworks compatible shell to run"
-
- Before I ran splat, I was running into problems with the program not returning
- to the shell prompt...I'd hit return, and sometimes it would return. At other
- times, it crashed....and since GNO traps crashes (as best it can) that just
- kept on happening. At other times, I've seen the usage message for gsh come
- up....
-
- usage: gsh bla bla bla
-
- for no reason, and then I can get control of the shell again. When I ran it
- in Orca, after it ran through (I'd input my 8 numbers and it would print them
- back successfully) it hung...then I proceeded to press RETURN once...it
- printed garbage numbers back (8 of them) as if they were input...made no
- sense.
-
- The odd thing is that this program works....it just won't exit back to the
- shell....does anyone have any idea what I'm doing wrong? Keep in mind that
- I'm learning C (put your hands together) -- so, now I'm stuck...it's more than
- likely something I'm doing, and since I can't check my code to an "answer" I
- have to rely on the expertise of those here :)
-
- Oh, and my appologies to Abe...the little birdy has stopped singging and may
- even be dead :)
-
- Thanks for puttin up with the s*it James --- /ignore don't work here :)
-
- Amrit
- achauhan@math.macalstr.edu
-