I need to be able to pass a 2D array into my function but I don't know the exact size of the array being passed before running it because the size of the array will be random. I also don't have control of the main function. The function I need to pass the array into is called Pathfinder and the call to it in main is Pathfinder(arr) and that can't be changed.
I've tried many different things including templates and pointers but with that function call I keep getting errors such as that the second value of the array needs to be instantiated and can't just be []
Templates might work but I don't think I implemented them correctly
char arr[15][20] ={{'s','w','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e'},{'e','w','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e','e'},{'e','w','e','w','w','w','w','w','w','w','w','w','w','w','w','w','e','w','w','w'},{'e','w','e','w','b','e','e','e','e','e','e','e','e','e','e','e','e','w','g','g'},{'e','w','e','w','w','w','w','w','w','w','w','w','w','w','w','w','e','w','g','g'},{'e','w','e','w','e','e','e','e','e','e','e','e','e','e','e','e','e','w','g','g'},{'e','w','e','w','e','w','w','w','w','w','w','w','e','e','e','e','e','w','g','g'},{'e','w','e','w','e','e','e','e','e','e','e','w','e','w','w','w','w','w','w','e'},{'e','w','e','w','e','e','b','e','e','e','w','w','e','w','e','e','e','e','w','e'},{'e','w','e','w','e','g','b','f','e','e','w','e','e','w','e','w','w','e','w','e'},{'e','w','e','w','e','e','b','e','g','g','w','e','e','w','e','e','w','e','w','e'},{'e','w','e','w','e','e','e','e','e','e','w','w','e','w','e','e','w','e','e','e'},{'e','w','e','w','e','e','e','e','e','e','e','w','e','w','e','e','w','e','e','e'},{'e','e','e','w','e','e','e','e','e','e','e','w','e','w','w','w','w','e','e','e'},{'e','w','e','w','e','e','e','e','e','e','w','e','e','e','e','e','e','e','e','e'},};
pathfinder(arr)
This is the function call from main and I have no control over that
vector<char> pathfinder(char arr[][])
This is my current function declaration but it doesn't work. It also has to be an array that's being passed in and can't be a vector because I can't change it. I can't do any global variables in main as I have no control over main for it will be provided for me, my function implementation and the relevant files are the only things I have control over