Question: a sequential structure is used to store strings and a string wildcard matching algorithm is compiled. The wildcard character is "?". It can match any character, such as pattern_index ("? Re "," there are ") returns 2. problem: stack around the variable "XX" was upted. A: the MSDN explanation is to read and write data outside the stack. The error is detected by the RTC1 compiler. I read more technical articles and found that when the project reaches a certain level, the programmer occupies a large amount of stacks. I also have a deep understanding. Because you have written a class, there is no error at runtime, but this error is easy to occur when adding member attributes without changing other methods. Therefore, I guess VS2005 (2008) limits the size of the stack internally. when the project is large enough, it will overflow.
Int pattern_index (SqString s, SqString t) {int I = 0, j = 0; while (I <s. length & j <t. length) {if (s. data [I] = t. data [j] | t. data [j] = '? ') {I ++; j ++;} else {I = I-j + 1; j = 0 ;}} if (j> = t. length) return (i-t.length); else return-1 ;}