W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
原型:extern char *strpbrk(char *s1, char *s2);
用法:#include <string.h>
功能:在字符串s1中尋找字符串s2中任何一個字符相匹配的第一個字符的位置,空字符NULL不包括在內。
說明:返回指向s1中第一個相匹配的字符的指針,如果沒有匹配字符則返回空指針NULL。
舉例:
// strpbrk.c
#include <syslib.h>
#include <string.h>
main()
{
char *s1="Welcome To Beijing";
char *s2="BIT";
char *p;
clrscr();
p=strpbrk(s1,s2);
if(p)
printf("%s\n",p);
else
printf("Not Found!\n");
p=strpbrk(s1, "Da");
if(p)
printf("%s",p);
else
printf("Not Found!");
getchar();
return 0;
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: