strdup
#include <string>
#include <iostream>
using namespace std;
void f(const string &s) {
cout << s;
std::string aa;
aa = s;
char* ab = strdup(aa.c_str());
cout << aa;
printf(ab);
}
int main() {
f("Hello world!");
}
#include <string>
#include <iostream>
using namespace std;
void f(const string &s) {
cout << s;
std::string aa;
aa = s;
char* ab = strdup(aa.c_str());
cout << aa;
printf(ab);
}
int main() {
f("Hello world!");
}