I am currently recreating a graph class that can display an adjacency matrix and find its respective DFS and BFS. While looking at reference code they used the following code to generate a multidimensional array.
I was under the assumption that the only way to make a multi dimensional array was:
data_type array_name[size1][size2]….[sizeN];
Is the pointer at the initialization setting up a multidimensional array such that each element in "array 1" contains another array "array 2?" Is this a dynamic array? And what would be their purpose for using this instead of initializing it the other way?
Code Mentioned:
adjmatrix = new int*[vertexCount];
for(int i=0;i<vertexCount;i++){
adjmatrix[i] = new int[vertexCount];
}
Source: Windows Questions C++