3차원 배열 동적할당
3차원 배열 동적 할당 방법 int A[100][200][300] 을 동적 할당. int x; int y; int ***A; A = new int ** [100]; for(x = 0; x < 100; x++) { A[x] = new int * [200]; for(y = 0; y < 200; y++) { A[x][y] = new int [300]; } } 메모리 해제 for(x = 0; x < 100; x++) { for(y = 0; y < 200; y++) { delete [] A[x][y]; } } for(x = 0; x < 100; x++) { delete [] A[x]; } delete [] A;
HW & SW
2007. 11. 12. 15:32