Just wonder if a literal string is a lvalue or a rvalue. Are other literals (like for int, float, char etc) lvalue or rvalue?
Is the return value of a function a lvalue or rvalue?
How do you tell the difference?
Just wonder if a literal string is a lvalue or a rvalue. Are other literals (like for int, float, char etc) lvalue or rvalue?
Is the return value of a function a lvalue or rvalue?
How do you tell the difference?
The C standard recognizes the original terms stood for left and right as in L = R
; however, it says to think of lvalue as locator value, which roughly means you can get the address of an object and therefore that object has a location. (See 6.3.2.1 in C99.)
By the same token, the standard has abandoned the term rvalue, and just uses "the value of an expression", which is practically everything, including literals such as ints, chars, floats, etc. Additionally, anything you can do with an rvalue can be done with an lvalue too, so you can think of all lvalues as being rvalues.