// method 1
//
int _objCache[100][200][300];
// method 2
int ***_objCache;
// allocation.
int x;
int y;
_objCache = new int ** [100];
for(x = 0; x < 100; x++)
{
_objCache[x] = new int * [200];
for(y = 0; y < 200; y++)
{
_objCache[x][y] = new int [300];
}
}
// deallocation.
for(x = 0; x < 100; x++)
{
for(y = 0; y < 200; y++)
{
delete [] _objCache[x][y];
}
}
for(x = 0; x < 100; x++)
{
delete [] _objCache[x];
}
delete [] _objCache;
//////
댓글 없음:
댓글 쓰기