I'm having trouble getting rid of the core segmentation fault on this code. It's creating a series of names in a 3-dimensional array with the dimensions row, col, and chars, where chars stores up to 5 letters of a name.
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
const int MAXSIZE = 11;
char*** names;
names = new char** [MAXSIZE];
cout << &names << " ";
for (int i = 0; i < MAXSIZE; ++i) {
names[i] = new char* [MAXSIZE];
cout << &names[i] << " ";
for (int j = 0; j < MAXSIZE; ++j) {
names[i][j] = new char [5];
cout << &names[i] << " " << i << j;
}
cout << endl;
}
I've inserted some debugging in there too. I see that it is able to finish assigning addresses, so I'm not sure what's going wrong. No other code is being done, even as I have deletes at the end that are all good.