I'm hitting an odd segmentation fault that is happening somewhere and I was wondering whether it could be due to the way I allocated the matrix array of pointers.
It's declared as such in the .h file:
int **matrix;
But when I pass it, I am using it in this way int *matrix[], in order to access individual rows with matrix[i] (this made a lot of my tasks simpler).
So, when I am allocating the matrix, should I have done:
matrix = new int * [vertices];
for (int i = 0; i < vertices; i++)
matrix[i] = new int[vertices];
Or for the third line, should I use the -> operator:
matrix[i]-> new int[vertices]; // Or something like this.
And what is the difference between the two?