I am looking for a hint (I am not a C programmer but have a need to maintain a C program) this function may already exist but I cannot find it.

I have 2 char string variables that contain x number of words in each. The number of words is always equal. if str1 has 4 words then str2 will have 4 words

char str1[] = "word1 word2 word3 word4";
char str2[] = "reply1 reply2 reply3 reply4";

I need to search str1 matching on one of the words and if I have a match I need to return the value in str2 for the same number word.

for example:

search str1 for the word "word3" (a match would be found in the third word in the string)
if match found return "reply3" (return the value of the the third word in the string)


In REXX I would do it as:

wordnum = wordpos('word3',str1)
return = WORD(str2,wordnum)

return would contain reply3 after these 2 statements were executed.

thanks in advance for any help.