码迷,mamicode.com
首页 > 其他好文 > 详细

L-value 和 R-value.

时间:2014-07-02 10:08:37      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   strong   cti   

  An L-value is something that can appear on the left side of an equal sign, An R-value is something that can appear on the right side of an equal sign.

  for example:

1 a = b + 25;

‘a‘ is an L-value because it identifies a place where a result can be stored.

‘b + 25‘ is an R-value because it designates a value.

  It sounds as though variable may be used as L-value but expressions may not, but this statement is not quite accurate,for example:

1 int a[3];
2 a[b + 1] = 0;

  Subscripting is in fact an operator so the construct on the left is an expression, yet it is a legitimate L-value because it identifies a specific location that we can refer to later in the program.

  Some operators, like indirection and subscripting, produce an L-value as a result.

L-value 和 R-value.,布布扣,bubuko.com

L-value 和 R-value.

标签:des   style   blog   color   strong   cti   

原文地址:http://www.cnblogs.com/listened/p/3819148.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!