I am making a program that will test for a string's existence in a string array. I have made a simple function to do so:
bool isMemberOfArrayStr(std::string str, std::string array[256]){
for(int i=0;array->length()<10;i++){
if(array[i]==str){
ret=true;//A global variable that will be reset to false after the function call
}
}
return ret;
}
The definition of the function causes no errors, but the call:
if(neighbors[2] == isMemberOfArrayStr(neighbors[2], validTokens))
{
std::cout <<"true"
}
Causes the runtime error "Segmentation fault: 11". I'm not sure what the problem is and help would be nice.