tags:

views:

32

answers:

1

Hi,

I defined a matrix structure in C using

typedef double mymatrix[30][30][10];

so now I define an array of them;

mymatrix AA[10];

now I tried to access, for a given matrix, the element (i,j,k), so I tried it for AA[5] using

AA[5][i][j][k] = 234.0;

is this the right way?

Thanks

+2  A: 

Yes, the first index will be for the final declared variable.

If you:

printf("%d\n", &AA[1][0][0][0] - &AA[0][0][0][0]);

you should see 9000, or the number of elements in mymatrix.

Amardeep
Amardeep knows all! Good answer!
JayG
Thanks for the props but I continue to learn far more on SO than I can ever give back.
Amardeep