Pointer confusions.... I'm dazzled
For some reason the first call with ptrPP to arrayFind() says not a ptr.... but 0 instead... not error... what's going on?
int *ptrPP[16] = { 0 };
//ptrPP = *playProfiles;
//find open playing slot
x = arrayFind(0, ptrPP, 0, 0); //error: invalid conversion from 'int**' to 'int' [-fpermissive]
x = arrayFind(0, 0, 0, 0); //error: invalid conversion from 'int**' to 'int' [-fpermissive]
int arrayFind(int value, int *arr, int sz, int match = 0) {
int i;
int matched = 0;
for (i = 0; i < sz; i++) {
int av = *arr;
if (av == value) {
matched++;
if (matched == match) {
return i;
}
}
arr++;
} //end for loop
return -1 * matched;
}