I assume you need a 2D array of char pointers. Your strNameList declaration is incorrect in both places of your program. You have:
char strNameList[][2] = { { "Luca","Daniel"} ,{"Vivan","Desmond"},{"Abdul","Justin"}, {"Nina","Marlene"},{"Donny","Kathlene"} };
But char[][N] declares a 2D array of chars , not char* . Therefore, you are warned by the compiler to which you assign a raft of pointer values ββfor elements of type char
Change both declarations (your variable and your function parameter) to:
const char *strNameList[][2]
which declares an array of unknown length of two char* arrays, which now matches your initialization lists. In addition, const added because (a) I assume that you do not plan to change this list of names in your function and (b) the string literal declarations assigned to char* through the initializer are undefined behavior in C and are officially deprecated in C ++, so you should not use it independently. Similarly, your search name probably also does not change, so also declare it const .
Result:
const char * strNameList[][2] = { {"Luca","Daniel"} , {"Vivan","Desmond"}, {"Abdul","Justin"}, {"Nina","Marlene"}, {"Donny","Kathlene"} };
and in your function:
int find_name(const char * strNameList[][2], const char strLookUp[])
Last, but certainly not least, if you do not have a crystal ball, your find_name() function is not able to find out with this information how many names are listed in the list of names. I would rather you see it now, and not be surprised at what happened next. you must either (a) end the list with the value of the token that find_name() knows find_name() , or (b) pass the number of names in the list to find_name() . To each his own, but I prefer the last of them:
int find_name(const char * strNameList[][2], size_t nNameListSize, const char strLookUp[])
and call it on the side of your caller:
find_name(strNameList, sizeof(strNameList)/sizeof(strNameList[0]), strFindName)