C++ examples for Function:Function Return
Dereferencing Your Return Value Immediately So You Don't Need to Use It as a Pointer
#include <iostream> #include <string> using namespace std; string *readCode() //w w w . j a v a 2 s. c o m { string *code = new string("ABCDEF"); return code; } int main() { string newcode; int index; for (index = 0; index < 10; index++) { newcode = *readCode(); cout << newcode << endl; } return 0; }