#include <iostream> using std::cout; using std::endl; #include <cstring> #include <cctype> const char *maximum( const char *first, const char *second ) { return ( strcmp( first, second ) >= 0 ? first : second ); } int main() { char s1[] = "h"; char s2[] = "g"; char *maxPtr = const_cast< char * >( maximum( s1, s2 ) ); cout << "The larger string is: " << maxPtr << endl; return 0; }
The larger string is: h