#include <stdio.h>
#include <string.h>
int cnt = 0, i,lenC;
char message [] = "the cat sat on the mat the";
char checkword [] = "the";
int main (void)
{
char *word, *msg;
lenC = strlen(message);
msg = message;
word = checkword;
for (i=0;i<lenC;i++){ // pass each char to word
//*temp++ = message[i];
while ((*word++ - *msg++) == 0){
cnt++; // increment counter
}
}
//printf("The word is: %s\n", word);
//printf("the sentence is: %s\n", *message);
printf("the word occurs %i times\n", cnt);
return 0;
}