C++ VC strstr函数的仿真
时间:2011-01-01 来源:秩名
char *strstr(register char *buf, register char *sub)
{
register char *bp;
if (!*sub) return buf;
for (;;)
{
if (!*buf) break;
bp = buf;
for (;;)
{
if (!*sub) return buf;
if (*bp++ != *sub++) break;
}
sub -= (unsigned long) bp;
sub += (unsigned long) buf;
buf += 1;
}
return 0;
}
标签分类:
相关阅读 更多 +