c++ – Dynamically allocate a 2D array with (2 * maxRow) rows and (2 * maxCol) columns using your createMap function

I need help with a dynamic array. I’ve got the first part to work and can use the createMap and deleteMap functions.


char** createMap(int maxRow, int maxCol) {
    //declaring a 2D char array and initializing it to have
    //maxRow number of rows
    char** map=new char*(maxRow);
    //looping through each row
    for(int i=0;i<maxRow;i++){
        //initializing memory for current row to have maxCol 
        //number of columns
        map(i)=new char(maxCol);
        //looping through each column, and setting value to TILE_OPEN
        //assuming TILE_OPEN variable is defined somewhere.
        for(int j=0;j<maxCol;j++){
    //returning the map created.
    return map;
void deleteMap(char** map, int maxRow) {
    for (int i = 0; i < maxRow; i++) {
        delete () map(i);
    delete () map;
char** resizeMap(char** map, int& maxRow, int& maxCol) {
    createMap = new int*(maxRow*maxCol);
    for (int i = 0; i < maxRow; ++i){
        map(i) = new char(maxCol);
        for (int j = 0; j < maxCol; ++j){
            delete() map(i);
        delete() map;
    return nullptr;

What am I doing wrong for the resizeMap function?