home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15643 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.4 KB  |  53 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!caen!sol.ctr.columbia.edu!sol.ctr.columbia.edu!rcormac
  3. From: rcormac@mark1.cs.oberlin.edu (Cormac (Xbattle -rcormac) Russell)
  4. Subject: Re: What is wrong with this very simple c program?
  5. In-Reply-To: aramsey@ugly.UVic.CA's message of Tue, 10 Nov 92 18:44:06 GMT
  6. References: <1992Nov10.184406.25907@sol.UVic.CA>
  7. Sender: nobody@ctr.columbia.edu
  8. Organization: Oberlin College Computer Science
  9. Date: Tue, 10 Nov 1992 21:04:17 GMT
  10. Message-ID: <RCORMAC.92Nov10160417@mark1.cs.oberlin.edu>
  11. X-Posted-From: mark1.cs.oberlin.edu
  12. NNTP-Posting-Host: sol.ctr.columbia.edu
  13. Lines: 38
  14.  
  15. Aaron sez:
  16. >
  17. >#include <stdio.h>
  18. >
  19. >main()
  20. >{
  21. >   int zoop[1000];
  22. >     int counter;
  23. >     
  24. >        printf ("started....");
  25. >           for (counter = 0; counter < 5000; counter += 5) {
  26. >             zoop[counter] = counter;
  27. >            }
  28. >               printf("done....");
  29. >               }
  30.  
  31. um, just a guess, but since counter is going to go over 999 (the
  32. 1000th entry in zoop), you are spraying the memory past wherever zoop
  33. happens to be with garbage. change:
  34. zoop[counter]=counter
  35. to
  36. zoop[counter/5]=counter
  37.  
  38. or change your for loop to incrememnt by 1 instead of 5 and make it
  39. zoop[counter]=counter*5;
  40.  
  41. Hope that solves it...
  42.    Blessed Be,
  43.       Cormac
  44.  
  45. --
  46. Retch The Grate aka Cormac Russell    Amiga, The Computer for The Creative Mind
  47.                       rcormac@occs.cs.oberlin.edu           
  48. Vote Libertarian in 92! Marrou/Lord!
  49.  
  50.  
  51.  
  52.  
  53.