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

2009/04/02 15:21
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;
        }
}
크리에이티브 커먼즈 라이선스
Creative Commons License

'정보통신전자공학부 > 프로그래밍' 카테고리의 다른 글

c언어 코드 최적화  (0) 2009/09/20
add files to folder 창이 안뜰때  (0) 2009/05/03
동적메모리, 배열 할당하는 법  (0) 2009/04/02
C언어 제곱, 루트  (3) 2009/04/01
JAVA - 테이블 관련  (0) 2008/12/02
C++ class static 멤버 함수, 변수  (0) 2008/11/06

밴스 정보통신전자공학부/프로그래밍