lhartzman
08-21-2008, 05:05 PM
As the subject says, I'm trying to figure out how to display a 1-d array as a 2-d array. Sample code:
int array[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int (* parr)[3] = (int (*)[3])array;
Putting in nested for loops with the outer one going from 0-3 and the inner one going from 0-2, I can print out each individual element specifying parr[j][k], (0 <= j <= 3; 0 <= k <= 2).
In the code I can obviously dive on 'array' and see a 12 element 1-d array. How do I specify displaying 'parr'?
On a related note, if array/parr contained data that could be visualized, how/what would I pass to $visualize to see the data? A slice of the data?
Thanks.
Les
int array[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int (* parr)[3] = (int (*)[3])array;
Putting in nested for loops with the outer one going from 0-3 and the inner one going from 0-2, I can print out each individual element specifying parr[j][k], (0 <= j <= 3; 0 <= k <= 2).
In the code I can obviously dive on 'array' and see a 12 element 1-d array. How do I specify displaying 'parr'?
On a related note, if array/parr contained data that could be visualized, how/what would I pass to $visualize to see the data? A slice of the data?
Thanks.
Les