Board index » delphi » Adding two multi-dimensional arrays

Adding two multi-dimensional arrays

Hi,

I'm trying to work out the syntax in Pascal for adding two multi-
dimensional arrays together. The arrays are 8 x 8. I can see  that two "FOR"
loops are needed, one for the rows and the other for the columns. Can someone
help me out with how you reference/change the array elements using Pascal.

Regards,

Peter

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

 

Re:Adding two multi-dimensional arrays


In article <7fgiko$ct...@nnrp1.dejanews.com>,

Quote
 <jehos...@my-dejanews.com> wrote:
>Hi,

>I'm trying to work out the syntax in Pascal for adding two multi-
>dimensional arrays together. The arrays are 8 x 8. I can see  that two "FOR"
>loops are needed, one for the rows and the other for the columns. Can someone
>help me out with how you reference/change the array elements using Pascal.

for i:=1 to rows do
  for j:=1 to cols do
    c[i,j]:=a[i,j]+b[i,j];

Osmo

Quote

>Regards,

>Peter

>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Other Threads