So I've read other Stack posts about this, and they all suggest that I use find
. I'm attempting this, but it doesn't work for me.
bool findInArray(int number, int array[]){
// Finds if the number is in the array
bool exists = find(begin(array), end(array), number) != end(array);
return exists;
}
But I keep getting the following error:
error: no matching function for call to ‘begin(int*&)’
It's even the accepted answer here: How can I check if given int exists in array?