Total Articles 180
[Source code]
#include <iostream> #include <string> using namespace std; string foo1() { string s = "hello"; return s; } string foo2() { string s = " world"; return s; } int main() { const char* p1 = foo1().c_str(); const char* p2 = foo2().c_str(); cout << p1 << p2 << endl; return 0; }
[Result]
gilgil@gilgil-PC /d/Temp/string_test
$ string_test
world world
[Download]