Return Two Dimentional Array of Pointers.

Hi,

I am trying to write a function which creates a 2d dynamic array.

I defined the array like this:

void matrix::CreateMatrix (){

int**ptr_matrix;

ptr_matrix = new int *[width]; // initalizes a pointer to pointer

for(int i=0;i<width;i++){

ptr_matrix[i] = new int [height]; // creates an array of pointers

}

}

How would i now make the function so it returns this array?
change the return type to int** and then return ptr_matrix?
Topic archived. No new replies allowed.