From: Endlisnis Newsgroups: comp.os.msdos.djgpp Subject: Re: Passing multidimentional arrays Date: Fri, 10 Jul 1998 11:24:12 -0300 Organization: University of New Brunswick Lines: 42 Message-ID: References: <3vep1.1610$e36 DOT 27573 AT news DOT mci2000 DOT com> NNTP-Posting-Host: sol-alt1.unb.ca Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <3vep1.1610$e36.27573@news.mci2000.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Fri, 10 Jul 1998, clint.allen wrote: ->specify the column subscript, but not the row subscript. The problem is, I ->have several arrays (or tables) of different sizes, and I'm trying to pass The easiest way to do this is to use a 1d array and fake the other dimensions: But this does require passing the Column size to the function. -> ->float table_lookup(float table[][], float reference) ...float table[], float reference, int ColSize) ->{ -> float tableValue -> int stop, pointer, xRef, yRef; -> for (stop = 0, pointer = 1; stop != 1; pointer++) -> { -> if (reference == table[pointer][0]) ...table[pointer*ColSize]) -> { -> yRef = pointer; -> stop = 1; -> } -> } -> for (stop = 0, pointer = 1; stop != 1; pointer++) -> { -> if (reference == table[0][pointer]) ...table[pointer]) -> { -> xRef = pointer; -> stop = 1; -> } -> } -> return tableValue[yRef][xRef]; //What the hell is 'tableValue'? Did you mean table or is this a global variable? If you mean table: return table[yRef*ColSize+xRef]; ->} -> ->Can anybody help? Yes. ->Clint Allen Endlisnis [I have a pyramid of wingyness]