본문 바로가기
Programing

동적메모리, 배열 할당하는 법

by 밴스 2009. 4. 2.
728x90
const int height = 480;
const int width = 640;

// 첫번째로 세로 배열 포인터 선언
int **ImageArray = new int*[height];

// 두번째로 가로로 동적메모리 할당
for(int cnt=0; cnt<height; cnt++)
{
        ImageArray[cnt] = new int[width];
}


// 초기화 해주는경우
for(int y=0; y<height; y++)
{
        for(int x=0; x<width; x++)
        {
                ImageArray[y][x] = 0;
        }
}
반응형

'Programing' 카테고리의 다른 글

Perceptron Traning Algorithm  (0) 2010.04.04
[MFC] 웹, http, html 자동로그인  (0) 2009.11.09
add files to folder 창이 안뜰때  (0) 2009.05.03
C언어 제곱, 루트  (5) 2009.04.01
cout 사용법  (0) 2007.12.03

댓글