First it seemed like a good idea, but I’m not so sure anymore.
What will happen to the content/data this function return?
Will the content/data properly be deleted when the program terminates, or will it cause a memory leakage?
I guess in general it's the same thing asCode:char* display(myenum type) { switch (type) { case type1: return "Type 1"; break; case type2: return "Type 2"; break; } } cout << "Type: " << display(enumvar);
Is this method by the book?Code:char* foo = “This is a text”;
What I’m trying to avoid is use the new/delete operation, because there is absolutely no reason why I need this value in a variable.
My plan is to use this function in both writing to file and screen.
Thanks!