Click to See Complete Forum and Search --> : Two-Dimensional Array Problem


typeR323
11-01-2005, 03:07 PM
I have a question. Please help me
I declare a two-dimensional array called anArray[][] and is it possible to create a function 'getVertex' which is able to return both values of Coordinate x and coordinate y of a point?
If so, how do I write this kind of function? Actually I already wrote getCoordinateX and getCoordinateY functions, which get values on x and y coordinates but they are separately.

BigDog
11-02-2005, 08:44 AM
I'm not sure I understand completely. Is anArray[][] populated with data? If so, and if you are lookign for a particular data set (such as 1,5 or osmething similar), you would need to loop through all the array dimensions looking for that value. You would just keep a counter of what position you were at in each array dimension, the combination of which would be you x/y coordinates.