where is rvalue stored in c?

2020-02-28 07:12发布

in C, i have this code piece:

int a;
a = 10 + 5 - 3

I want to ask: where is (10+5-3) stored at? (As far as I know, a is located on stack, how about (10+5-3)? How does this rvalue get calculated?)

标签: c rvalue
7条回答
Anthone
2楼-- · 2020-02-28 07:58

Your question is based on an incorrect premise.

The defining property of lvalue in C is that it has a place in storage, i.e it is stored. This is what differentiates lvalue from rvalue. Rvalue is not stored anywhere. That's what makes it an rvalue. If it were stored, it would be lvalue by definition.

查看更多
登录 后发表回答