Code:
int findString (const char source[], const char s[])
{
int i, j, foundit = false;
// try each character in source
for ( i = 0; source[i] != '\0' && !foundit; ++i ) {
foundit = true;
// now see if corresponding chars from s match
for ( j = 0; s[j] != '\0' && foundit; ++j )
if ( source[j + i] != s[j] || source[j + i] == '\0' )
foundit = false;
if (foundit)
return i;
}
return -1;
}
How would I go about using pointers in this function rather than array notation? Kind of confused on the pointers and their uses. Thanks in advance for the help.