Mega Code Archive

 
Categories / C++ / Data Type
 

Memchr( ) function

#include <string.h> #include <stdio.h> char buf[35]; char *ptr; int main( ) {  strcpy(buf,"This is a fine day for a search." );  ptr=(char *)memchr(buf,'f',35);  if (ptr != NULL)    printf("character found at location: %d\n",           ptr-buf+1);  else    printf("character not found.\n");  return (0); }