void foo(const char* str) { if (*str == '\0') return; printf("%c", str[0]); std::string x = str + 1; return foo(x.c_str()); }