In function 'int main()': 16:26: error: cannot convert 'std::string {aka std::basic_string<char>}' to 'char*' for argument '1' to 'bool magic(char*, char*)'
The str is a std::string
Function parameter must have type char*
std::string has member c_str() that returns a constchar*
that would not work either, because the magic() reserves the option to modify its parameter.
If string would modification of its content like that, then you could bypass the encapsulation and render the string inconsistent and invalid.