View Full Version : 4D arrays... under what situations would you use them, if at all?

06-02-2002, 09:25 PM
read subject heading.

06-02-2002, 09:30 PM
Who knows. Could be plenty of reasons. What if you had an array representing a 3D space where each element was to contain a string description of the element?

char 3DSpace[10][10][10][50];

Just the first simple idea that popped to mind. ... Why?

06-02-2002, 09:58 PM
Database application is another one.

06-03-2002, 01:15 PM
3d space plus time

06-03-2002, 03:37 PM
I've seen them used several times just for the sake of simple storage. I don't think there's a reason for them to be obscure.

06-03-2002, 05:12 PM
If you get a school assignment to use 4D arrays?

06-03-2002, 06:54 PM
Originally posted by toaster
read subject heading.

4d array is not hard to build up but the concept is hard to understand. ;)

06-03-2002, 08:06 PM
concept is hard to understand.

int g_4DArray[5][5][5][5];
Nah, just visualize a 5*5*5 3D Cube, and each element cooresponds to a 1D array of 5 elements.

06-03-2002, 08:16 PM
And what about 9D? ;) (See Imagination thread.)

06-03-2002, 11:47 PM
Is there a way to build an array of arrays.. Line

inr arrat[int array1[][][]]

does it work.....

06-04-2002, 12:12 AM
I believe what you'd be looking for is an array of structs such as:

int SomeInts[10][10][10];
} MyStructArray[10][20];

Though in this situation I dont know why you would just use:

int SomeInts[10][20][10][10][10];