Not sure if I deleted multidimensional pointer array correctly

My code below attempts to (1) create a multidimensional pointer array; (2) populate it with numbers; (3) print the populated array as a table; (4) delete the array; and finally (5) print the (now deleted) array as a table, again.

What's puzzling me is that the second printed table shows what appear to be random numbers for all but the last row of my array. The random numbers are expected, given the pointer has been deleted, but what's going on with the last row?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>

using namespace std;

void showArray( int** p_p_multDArray )
{
    for( int i =0; i < 3; i++ )
    {
        cout << '\n';
        for( int j = 0; j < 3; j++ )
        {
            cout << '\t' << p_p_multDArray[i][j];
        }
    }
    cout << '\n';
}
void deleteMultDArray( int** p_p_multDArray )
{
    for( int i = 0; i < 3; i++ )
    {
        delete [] p_p_multDArray[i];
    }
    delete [] p_p_multDArray;
}
void populateArray( int** p_p_multDArray )
{
    for( int i = 0; i < 3; i++ )
    {
        for( int j = 0; j < 3; j++ )
        {
            p_p_multDArray[i][j] = i + j;
        }
    }
}
int main ()
{
    int** p_p_multDArray = new int*[3];
    for( int i = 0; i < 3; i++ )
    {
        p_p_multDArray[i] = new int[3];
    }
    populateArray( p_p_multDArray );
    showArray( p_p_multDArray );
    deleteMultDArray( p_p_multDArray );
    showArray( p_p_multDArray );
    return 0;
}
but what's going on with the last row?
Values are just not overwritten yet.
Topic archived. No new replies allowed.