- 声望
- 0 点
- 西工币
- 538 枚
- 贡献值
- 0 点
- 好评度
- 0 点
- 最后登录
- 2008-7-7
- 注册时间
- 2008-5-29
- 帖子
- 53
- 精华
- 0
- 积分
- 53
- 阅读权限
- 30
- UID
- 15738
 
该用户从未签到 - 西工币
- 538 枚
- 好评度
- 0 点
- 声望
- 0 点
- 注册时间
- 2008-5-29
- 帖子
- 53
- 积分
- 53
- UID
- 15738
|
#include <string.h>
#include <stdio.h>
char str[] = "编程兴趣小组";
char string[] = "我在编程兴趣小组等你!";
void main( void )
{
char *pdest;
int result;
printf( "我找到你了:\n\t%s\n", str);
pdest = strstr( string, str );
result = pdest - string + 1;
if( pdest != NULL )
printf( "%s 在 %s 的第 %d\n\n", str, string,result );
else
printf( "%s 没有发现\n", str );
}
// Output
我找到你了:
编程兴趣小组
编程兴趣小组 在 我在编程兴趣小组等你! 的第 3 |
|