I'm trying to pass a 2D array to a function to initialize it. I can't use vectors for this project. 'unique' is an integer produced from reading in a file. I'm trying to pass my array as such:
void initialize(int adjMatrix[unique][unique])
{
// initialize
}
void main()
{
int adjMatrix[unique][unique];
initialize(adjMatrix);
}
I am getting the following error when trying to compile with clang++:
"candidate function not viable: no known conversion from 'int [unique][unique]' to 'int (*)[unique]' for 1st argument void initialize(int adjMatrix[unique][unique]);"
Is there a better way for me to pass this 2D array? I have tried the suggestions at this link: Passing a 2D array to a C++ function
Passing these arrays in this manner works for me in Visual Studio 2019, but I am using Visual Studio Code and compiling with clang++ from Ubuntu now, could this be causing my issue? Thank you.