私はコードを見つけました:
char *BoyerMoore_negative(char *string, int strLength)
{
char *data ="nice bad good worst";
int dataLength = strlen(data) - 1;
int skipTable[256], i;
char *search;
register char lastChar;
if (strLength == 0)
return NULL;
// Initialize skip lookup table
for (i = 0; i < 256; i++)
skipTable[i] = strLength; //strlength is numbers of words in sentence
search = string; //string is array of words in the sentence
i = --strLength; // Decrease strLength here to make it an index
do {
skipTable[*search++] = i; // ---> skiptable is int array and search is string. Then what happens on LHS on each iteration???
} while (i--);
lastChar = *--search; // ---> Decreamenting string pointer? What does it mean on RHS?
do {
// Have we found the entire string?
if (i-- == 0)
return search;
} while (*--search == string[i]);
// Skip past the part of the string that we scanned already
search += (strLength - i + 1); ---> what happends here?
dataLength--;
誰かが ---> ポインタのヒントを与えることができますか? このような質問ができるかどうかはわかりませんが、これらの概念を理解するために質問しました。