No matching function call

Im trying to pass a pair, a char, and a 2d array into a function call but i get the no matching function call error.

Function:
 
  bool threePathCheck(pair <int, int> pos, char *wallMarker, char arrMaze[SIZE][SIZE])


Function Call:
 
  storeStack = threePathCheck(pos, *wallMarker, arrMaze[SIZE][SIZE])


Ive tried removing [SIZE][SIZE] from the function call but that didnt work either. pos is a pair.
Last edited on
Is the wallMarker argument a C-string? If so, when you do *wallMarker you are dereferencing it and getting a char instead of a char*.
i defined wall marker as a pointer to a const char X.
 
const char *wallMarker = "X";


I also tried it without the * and got the same error.

I have a feeling it may have something to do with the 2d array

i also called the function:
 
 storeStack = threePathCheck(pos, *wallMarker, arrMaze)


but i still get an error. I literally dont have any clue why lol
Last edited on
You can't pass a pointer to a const object to a function that takes a pointer to a non-const object as its argument.
In other words, either do
 
bool threePathCheck(pair <int, int> pos, const char *wallMarker, char arrMaze[SIZE][SIZE])

or
char *wallMarker = "X";

Call the function like so
 
storeStack = threePathCheck(pos, wallMarker, arrMaze)
as soon as i posted i realized it was a const char and got it working. Thanks for your help!! :)

It was a combo of the const char and passing the array wrong. Thanks again!!!
Topic archived. No new replies allowed.