Do pointers to string literals remain valid after a function returns?

Viewed 4898

Is the pointer returned by the following function valid?

const char * bool2str( bool flg )
{
    return flg ? "Yes" : "No";
}

It works well in Visual C++ and g++. What does C++ standard say about this?

4 Answers
Related