home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / apple2 / gno / 325 < prev    next >
Encoding:
Text File  |  1992-11-16  |  2.6 KB  |  75 lines

  1. Newsgroups: comp.sys.apple2.gno
  2. 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
  3. From: chauhan@aristotle.ils.nwu.edu (Amrit Chauhan)
  4. Subject: Crash............
  5. Message-ID: <1992Nov16.073159.14009@ils.nwu.edu>
  6. Sender: usenet@ils.nwu.edu (Mr. usenet)
  7. Nntp-Posting-Host: aristotle.ils.nwu.edu
  8. Organization: The Institute for the Learning Sciences
  9. X-Newsreader: Tin 1.1 PL5
  10. Date: Mon, 16 Nov 1992 07:31:59 GMT
  11. Lines: 62
  12.  
  13. I am in the process of learning C, and obviously, I have some really dinky C
  14. programs.  Well, this one crashes...in very weird ways.  Take a look:
  15.  
  16. -- cut here --
  17.  
  18. /* prob8.c -- Programming Exercises (Chapter VI, Problem 8) */
  19. #include <stdio.h>
  20. #define MAX 7
  21. main()
  22. {
  23.         int i, integers[MAX];
  24.  
  25.         printf("Please enter 8 integer values below:\n");
  26.  
  27.         for(i = 0; i <= MAX; i++)
  28.                 scanf("%d", &integers[i]);
  29.         printf("Right back at you...\n");
  30.  
  31.         for(i = MAX; i >= 0; i--)
  32.                 printf("%d ", integers[i]);
  33.         printf("\n");
  34. }
  35.  
  36.  
  37. -- cut here --
  38.  
  39. Ok...this program simply inputs eight integers and then prints them back out
  40. in reverse order....like I said, not on the order of your typical GNO program
  41. :)  But, it still crashes.....
  42.  
  43. I put this through Splat!(tm) and when it finished (it actually runs all the
  44. way through with no problems) Splat!(tm) printer something like:
  45.  
  46. "Splat! requires Byteworks compatible shell to run"
  47.  
  48. Before I ran splat, I was running into problems with the program not returning
  49. to the shell prompt...I'd hit return, and sometimes it would return.  At other
  50. times, it crashed....and since GNO traps crashes (as best it can) that just
  51. kept on happening.  At other times, I've seen the usage message for gsh come
  52. up....
  53.  
  54. usage: gsh bla bla bla
  55.  
  56. for no reason, and then I can get control of the shell again.  When I ran it
  57. in Orca, after it ran through (I'd input my 8 numbers and it would print them
  58. back successfully) it hung...then I proceeded to press RETURN once...it
  59. printed garbage numbers back (8 of them) as if they were input...made no
  60. sense.
  61.  
  62. The odd thing is that this program works....it just won't exit back to the
  63. shell....does anyone have any idea what I'm doing wrong?  Keep in mind that
  64. I'm learning C (put your hands together) -- so, now I'm stuck...it's more than
  65. likely something I'm doing, and since I can't check my code to an "answer" I
  66. have to rely on the expertise of those here :)
  67.  
  68. Oh, and my appologies to Abe...the little birdy has stopped singging and may
  69. even be dead :)
  70.  
  71. Thanks for puttin up with the s*it James --- /ignore don't work here :)
  72.  
  73. Amrit
  74. achauhan@math.macalstr.edu
  75.