xhcuoi.c
来自「Many C samples. It is a good sample for 」· C语言 代码 · 共 26 行
C
26 行
/* Tim vi tri xuat hien cuoi cung cua mot chuoi con trong mot chuoi */
#include <stdio.h>
#include <string.h>
int xhcuoi (char *source, char *substr)
{
char *found, *tmpstr;
tmpstr = found = source;
while ((found = strstr(found, substr)) != NULL)
{
tmpstr = found;
found++;
}
return tmpstr - source;
}
void main()
{
char source[250], substr[250];
printf("\nNhap chuoi nguon : ");
gets(source);
printf("\nNhap chuoi tim kiem : ");
gets(substr);
printf("\nVi tri xuat hien cuoi cung = %d", xhcuoi(source, substr));
getch();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?