I'm trying to understand an example of a graph represented by an adjacency matrix. I'm having trouble with the following code:
private:
bool** adjacencyMatrix;
int vertexCount;
public:
Graph(int vertexCount) {
this->vertexCount = vertexCount;
adjacencyMatrix = new bool*[vertexCount];
for (int i = 0; i < vertexCount; i++) {
adjacencyMatrix[i] = new bool[vertexCount];
for (int j = 0; j < vertexCount; j++)
adjacencyMatrix[i][j] = false;
}
}
I understand that adjacencyMatrix
now points to an array of pointers to bool, But I can't understand why there are two **
in the declaration of adjacencyMatrix
.
I know I'm missing something very rudimentary but I just can't understand it. I've searched the Internet and couldn't find anything.
I just came here because there are so many knowledgeable and helpful people!