This is one function in .h file
LinkedListElement<char> * findLastNthElementRecursive(int n, int ¤t);
Try both
findLastNthElementRecursive(3,0);
and
int a = 0;
findLastNthElementRecursive(3,&a);
error is no matching function
I GOT IT findLastNthElementRecursive(3,a); SHOULE BE THIS WAY
but if I do not want to create new variable like a, how to do that?
A temporary cannot bind to a non-
constreference. In your first case, you attempt to pass a temorary as parameter, and it fails.The second one doesn’t work because
&ais the address ofa, effectively anint*, so doesn’t match the signature of the function.The correct way would be