#include // strlen cstring c library #include // C++ strings class //#include in iostream //compare_find_memchr1.cpp using namespace std; int main() { //compare memchr and string.find char *chfind1;string str1; size_t strfind1; char chstr1[] = "hello world"; str1 = "hello world"; chfind1=(char*) memchr(chstr1,'w',strlen(chstr1)); strfind1 = str1.find("world"); cout << "Letter w was found at : "<< chfind1-chstr1+1; cout<< "\n word world found at : "<< int(strfind1+1); return 0; }