Jul 11, 2017

[C++] char string literal is l-value

Why are string literals l-value while all other literals are r-value?

C++03 5.1 Primary expressions
§2:
A literal is a primary expression. Its type depends on its form (2.13). A string literal is an lvalue; all other literals are rvalues.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.