?? 3-10.c
字號:
#include "stdio.h"
#include <string.h>
int nfind ( char *B, char *A )
{
int i, j, start = 0;
int lasts = strlen (B ) -1;
int lastp = strlen ( A) -1 ;
int endmatch = lastp;
for(i=0; endmatch<=lasts; endmatch++, start++) {
if ( B[endmatch] == A[lastp ])
for ( j=0, i=start; j<lastp && B[i]==A[j]; i++,j++)
;
if ( j == lastp )
return start; /*成功 */
}
return -1;
}
void main ()
{
char s[]="Sit please.";
char t[]="please ";
int po=nfind(s,t);
printf("%d",po);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -