C语言 - 查找包含字符位置函数的使用

来源:互联网 发布:网络主播玩的小游戏 编辑:程序博客网 时间:2024/05/22 09:42
/**********************************************************文件名称: 查找包含字符函数的使用基本操作: strpbrk()声明于头文件string.h使用方法:从第一个字符开始比较,遇到相同字符结束~  并返回当前字符位置指针,用该指针可输出~  接下来的字符串完成日期:2015 - 12 - 19编程平台:Visual Studio 2015**********************************************************/#include <stdio.h>#include <stdlib.h>#include <string.h>int main(void){char *str1 = "Two World";char *str2 = "One Dream";char *tmp = NULL;// 返回位置指针tmp = strpbrk(str1, str2);printf("\n\t剩余字符串:%s\n", tmp);system("pause");return 0;}

 

运行结果:



如果没有相同的字符就返回NULL


0 0