Advertisement

Multidimensional Arrays

Started by March 11, 2002 03:40 PM
1 comment, last by sanguineraven 22 years, 9 months ago
i am programming a simple maze in pascal, using 1 and 0 values to define a space and a wall. I want to use an array 10 down and 10 acrossm like: ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** where each * is a cell storing a 1 or 0. However i am a bit rusty on multidimensional arrays. i think defining is: main_area : array [1..10,1..10] of integer; is this right? is the first array i set across and the second down? i wish to save it as this in a text file and then read this into the array, but when i tried and then tried printing out the array to screen it put it all on one line when i asked it only to do [1,k] where k is the loop variable, surely this should just do one line? What about me? What about Raven?
Why dont you try that array declaration, I have not coded in Pascal for quiet a while now and dont have access to a compiler but try it... Thats the best way u will know. As for the rows and columns of arrays, the first subscript always refers to the row where the data is on and the second is the column

e.g

array[row][column]=number;


hope it helped

Dark Star
UK
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
Advertisement
The accepted convention for arrays is row, col, but there''s no reason why you can''t reverse it as long as you stick with the same system thoughout the program.

,Jay

This topic is closed to new replies.

Advertisement