I just started learning C. What I am trying to right now is that I have two strings in which each word is separated by white spaces and I have to return the number of matching words in both strings. So, is there any function in C where I can take each word and compare it to everyother word in another string, if not any idea on how I can do that.
Share
Break up the first string in words, this you can do in any number of ways everything from looping through the character array inserting
\0at each space to usingstrtok.For each word found, go through the other string using
strstrwhich checks if a string is in there. just check return value fromstrstr, if!= NULLit found it.