Array of arrays of arrays in C -
how declare array of arrays of arrays? have array s[]
. s[0]
contain other array a[]
, a[0]
contain array b[]
. how pointers?
// b array of int. (n number.) int b[n]; // option 0: array of m arrays of n int. (m number.) int a[m][n]; // option 1: array of m pointers int. int *a[m]; a[0] = b; // other elements of must assigned in way. // s option 0: s array of l arrays of m arrays of n int. (l number.) int s[l][m][n]; // s option 1: s array of l arrays of m pointers int. int *s[l][m]; s[0][0] = b; // other elements of s must assigned in way. // s option 2: s array of l pointers arrays of n int. int (*s[l])[n]; s[0] = a; // can use option 0, not option 1. // other elements of s must assigned in way. // s option 3: s array of l pointers pointers int. int **s[l]; s[0] = a; // can use option 1, not option 0. // other elements of s must assigned in way.
there options in each object pointer @ highest level, instead of array. have not shown those. require defining pointer point to.
Comments
Post a Comment