C++
포인터를 파라미터로 넘겨 동적할당
sukay
2011. 6. 20. 07:27
동적할당하는 함수 구현
** (x)
**& (o)
void alloc(int **&src,int w,int h);
void main(){
int **src;
alloc(src,w,h);
}
void alloc(int **&src,int w,int h){
int i,j;
src = new int*[h];
for(i=0;i<h;i++){
src[i] = new int[w];
}
}