[Solved] cout corrupt char* [closed]

[ad_1] You are passing a pointer to a local variable. Once your function ends, this variable is gone. If this is C++ you should use the string class. If for whatever reason you don’t, at least be const correct: const char* Worker::getName() const { return name; } 1 [ad_2] solved cout corrupt char* [closed]