Code: Cpp Code: #include <string.h> #include <stdio.h> int main() { char word[80], subword[80], *poz; printf("Enter wordn"); scanf("%s",word); printf("Enter subwordn"); scanf("%s",subword); if ((poz = strstr(word, subword))) { printf("%s is sub word of %s at position %dn", subword,word,poz - word + 1); } else { printf("%s isn't subword of %sn",subword,word); } return 0; }
Is this a demo program, or do you have some questions about it? It's not very helpful just to post code without any kind of comments.