I want to find if Array B is present in array A(B is a substring of A)..
i have written this small function but its not working as desired ..can anybody plz help and point out where i m wrong
bool substring(char A[],char B[])
{
int aSize=strlen(A);
int bSize=strlen(B);
bool matched =true;
int count =0;
for (int i=0;i<aSize;)
{
if(A[i]==B[0])
{
for(int compare= 0;compare< bSize;)
{
if(A[i+compare]==B[compare])
{
matched =true;
compare++;
cout << "eeeee\n";
}else
{
matched = false;
break;
}
}
if(matched == true)
{
return true;
}
}else
{
i++;
}
}
return matched;
}