SyntaxFix
Write A Post
Hire A Developer
Questions
Another solution might look like this,
char arr[] = "mom"; std::cout << "hi " << std::string(arr);
which avoids using an extra variable.