I need get position of word in text, but I can't convert a pointer with char *text to char text[] to compare each character.
I am trying to find the location of the first substring in a text that matches a particular word.
#include <stdio.h>
#include <string.h>
int searchWord(char *word, char *text);
int main (int argc, char *argv[])
{
int i,searchString;
if (!(argc>2)) {
printf("Need 2 args");
return 0;
}
printf("aaa %d\n" ,searchWord(argv[1],argv[2]));
return 0;
}
int searchWord(char *word, char *text) // I need use that function to search.
{
printf("\n\n%s\n\n",&word[0]);
return 0;
}