memchr() 函数
下面是介绍这个函数给出的例子,好像有问题哦函数名: memchr
功 能: 在数组的前n个字节中搜索字符
用 法: void *memchr(void *s, char ch, unsigned n);
程序例:
#include <string.h>
#include <stdio.h>
int main(void)
{
char str[17];
char *ptr;
strcpy(str, "This is a string");
ptr = memchr(str, 'r', strlen(str));
if (ptr)
printf("The character 'r' is at position: %d\n", ptr - str);
else
printf("The character was not found\n");
return 0;
}