This is what I have so far:
for(i = 0; i <= 9; i++){
printf("%d", i);
found = strpbrk(nameholder[i], searchterm);
if(strpbrk(nameholder[i], searchterm) == searchterm){
printf("found\n");
foundwhere = i + 1;
break;
}
}// end for
When I run the program, the strpbrk function finds the string, but for some reason it never triggers the if statement. What am I missing?
If I correctly understood (your description is vague) what you are trying to do, then you seem to be using a wrong function.
Quoting cpp docs on strpbrk:
That’s not what you want it to do, right? You should be looking at
strcpmfunction.http://www.cplusplus.com/reference/clibrary/cstring/strcmp/
Your code should look like: