Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!qualcom.qualcomm.com!maui.qualcomm.com!rdippold From: rdippold@maui.qualcomm.com (Ron Dippold) Newsgroups: comp.os.msdos.programmer Subject: Re: QuickC compiler bug with 2D array? Message-ID: <1991Feb19.202412.23560@qualcomm.com> Date: 19 Feb 91 20:24:12 GMT References: <1991Feb19.062220.26093@agate.berkeley.edu> Sender: news@qualcomm.com Distribution: comp.os.msdos.programmer; alt.msdos.programmer; comp.lang.c Organization: Qualcomm, Inc., San Diego, CA Lines: 15 In article <1991Feb19.062220.26093@agate.berkeley.edu> bmyers@garnet.berkeley.edu (Brian Myers) writes: > >The following code was excerpted from a longer program for constructing >crossword puzzles. This short program does not work because each >assignment statement seems inexplicably to assign a value to *two* >different array elements at the same time. I observed this double >action with the "Watch Value" feature on the Debug menu. > >CELL grid[14][14]; /* crossword puzzle grid 15x15 */ > There's your problem... When you declare an array x[14], you are declaring an array with a size of 14, from [0] to [13]. So your grid[14][14] is the same as a pascal declaration grid[0..13][0..13]. That's why it changes "two" values. grid[1][14] IS actually grid[2][0].