C++ examples for Data Type:char array
Using strpbrk searches for the first occurrence of a substring
#include <iostream> #include <cstring> // strpbrk prototype using namespace std; int main() /*from www. ja va 2 s . com*/ { const char *string1 = "This is a test"; const char *string2 = "beware"; cout << "Of the characters in \"" << string2 << "\"\n'" << *strpbrk( string1, string2 ) << "\' is the first character " << "to appear in\n\"" << string1 << '\"' << endl; return 0; }