BF

 1 int Index_BF ( char S [ ], char T [ ], int pos )
 2 
 3 {
 4     int i = pos, j = 0;
 5     while ( S[i+j] != '\0'&& T[j] != '\0')
 6         if ( S[i+j] == T[j] )
 7             j ++; 
 8         else
 9         {
10             i ++;
11             j = 0; 
12         }
13     if ( T[j] == '\0')
14         return i; 
15     else
16         return -1; 
17 } 

 

posted @ 2013-08-22 21:21  WangLC  阅读(161)  评论(0编辑  收藏  举报