🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4792

Re: QuickC compiler bug with 2D array?

#4792
From: Ron Dippold
Date: Tue, 19 Feb 1991 20:24
15 lines
1361 bytes
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].
Technical Details
Message-ID: <1991Feb19.202412.23560@qualcomm.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!qualcom.qualcomm.com!maui.qualcomm.com!rdippold
References: <1991Feb19.062220.26093@agate.berkeley.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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