Pointer to a dynamic multi-dimensional array
Could someone please tell me why the following code does not work for a dynamic multidimensional array. Thank you.
Code:
HashTable::HashTable()
// default constructor
{
// create a dynamically-allocated table of type String
// with row equal to default size and column equal to 2
int **p; // declare a pointer of type String
p = new int[TABLE_SIZE][2];
}
On Dynamic Multi-dimensional arrays and hash tables
Hey all,
I would like to like to know if there are any links that I might go to get a detailed explanation of dynamic multi-dimensional arrays. It seems like I would have to dynamically re-size my 2D-array later on.
Another question... and this has been bugging me since I started this assignment... I would like to know if I could use a 2D array to implement a hashtable (in this case, the application is an address book) that takes in a name and an address. Now the only way that I could conceive of the idea of a hash table as a data structure is by having a two-dimensional array, that being n rows and 2 columns, one cell for the name and another for the address. Just wanted to know if I was on the right track.
Thank you in anticipation.