SyntaxFix
Write A Post
Hire A Developer
Questions
word is on the stack and goes out of scope as soon as getStr() returns. You are invoking undefined behavior.
word
getStr()