Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Searching for sub-word (http://www.go4expert.com/forums/searching-sub-word-t15557/)

Gravedigger 20Dec2008 20:30

Searching for sub-word
Code: Cpp

#include <string.h>
#include <stdio.h>

int main()
        char word[80], subword[80], *poz;
        printf("Enter wordn");
        printf("Enter subwordn");
        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;

xpi0t0s 21Dec2008 08:06

Re: Searching for sub-word
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.

All times are GMT +5.5. The time now is 14:15.