Re: Static data?
Re: Static data?
- Subject: Re: Static data?
- From: "Philip" <email@hidden>
- Date: Wed, 7 Jul 2004 00:25:13 -0700
> > So, now, the previous post confused me. What is the _correct way of
> > doing this:
> >
> > int foo[1024][1024][1024];
> >
> > dynamically?
I would recommend the the following C++ syntax; it comes with limited type
checking:
// declare var and allocate
int (*array) [1024][1024] = new int [1024][1024][1024];
// then use the array like...
array[10][10][10] = 12;
// the following line generates a compiler error; wrong type
array[10][10] = 12;
// and dispose of the array like...
delete [] array;
// alternatively, you can make the first dimension a variable:
int dimension = 1024;
int (*array1) [1024][1024] = new int [dimension][1024][1024];
enjoy.
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.