home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!caen!sol.ctr.columbia.edu!sol.ctr.columbia.edu!rcormac
- From: rcormac@mark1.cs.oberlin.edu (Cormac (Xbattle -rcormac) Russell)
- Subject: Re: What is wrong with this very simple c program?
- In-Reply-To: aramsey@ugly.UVic.CA's message of Tue, 10 Nov 92 18:44:06 GMT
- References: <1992Nov10.184406.25907@sol.UVic.CA>
- Sender: nobody@ctr.columbia.edu
- Organization: Oberlin College Computer Science
- Date: Tue, 10 Nov 1992 21:04:17 GMT
- Message-ID: <RCORMAC.92Nov10160417@mark1.cs.oberlin.edu>
- X-Posted-From: mark1.cs.oberlin.edu
- NNTP-Posting-Host: sol.ctr.columbia.edu
- Lines: 38
-
- Aaron sez:
- >
- >#include <stdio.h>
- >
- >main()
- >{
- > int zoop[1000];
- > int counter;
- >
- > printf ("started....");
- > for (counter = 0; counter < 5000; counter += 5) {
- > zoop[counter] = counter;
- > }
- > printf("done....");
- > }
-
- um, just a guess, but since counter is going to go over 999 (the
- 1000th entry in zoop), you are spraying the memory past wherever zoop
- happens to be with garbage. change:
- zoop[counter]=counter
- to
- zoop[counter/5]=counter
-
- or change your for loop to incrememnt by 1 instead of 5 and make it
- zoop[counter]=counter*5;
-
- Hope that solves it...
- Blessed Be,
- Cormac
-
- --
- Retch The Grate aka Cormac Russell Amiga, The Computer for The Creative Mind
- rcormac@occs.cs.oberlin.edu
- Vote Libertarian in 92! Marrou/Lord!
-
-
-
-
-