标签:+= amp val The potential assign 左值 his after
1
2 int main(void)
3 {
4 int a=1;
5 char *pp;
6 void *p=&a;
7 p++;
8 p+=a;
9 pp=(char *)p;
10 pp+=a;
11 //(char *)p +=a;
12 }
(char *)p +=a; 会报左值错误
The result of (int *) p
is a value. This is different from an lvalue. An lvalue (potentially) designates an object. For example, after int x = 3;
, the name x
designates the object that we defined. We can use it in an expression generally, such as y = 2*x
, and then the x
is used for its value. But we can also use it in an assignment, such as x = 5
, and then the x
is used for the object.
标签:+= amp val The potential assign 左值 his after
原文地址:https://www.cnblogs.com/idyllcheung/p/13129949.html