请高人帮忙写一个“查找一个字符串在另外一个字符串中最后一次出现的地址”,先谢谢了
非常非常感谢!!!
程序代码:#include <string.h>
// 返回s1在s2中最后一次出现的地址,如果s1不在s2中返回NULL
char * search(char* s1, char* s2) {
int i, s1_len = strlen(s1), end = strlen(s2) - s1_len;
char* last_index = NULL;
for (i = 0; i <= end; i++)
if (!strncmp(s1, s2 + i, s1_len))
last_index = s2 + i;
return last_index;
}









