Left and right-topics caused by group chat

Source: Internet
Author: User

 

Product (466291086) 11:08:35
A = 4; (a ++) + = A; evaluate
(This message is sent by the member through the mobile phone QQ, experience mobile phone QQ please login: http://mobile.qq.com/C)
Itgrit [C/C ++ MFC] (286715286) 11:09:13
9
[Prompt: This user is using webqq: http://web.qq.com /]
Qin Wei (871452271) 11:09:14
9?
Itgrit [C/C ++ MFC] (286715286) 11:09:22
Haha
Product (466291086) 11:09:28
Ele. Me
Product (466291086) 11:09:35
Master
Cuiwow (157808076) 11:09:40
Isn't it necessary to look at the specific compiler ..?
Product (466291086) 11:09:44
Next
Itgrit [C/C ++ MFC] (286715286) 11:09:47
?
Product (466291086) 11:09:52

Lander (530468003) 11:09:51
Complicated
Itgrit [C/C ++ MFC] (286715286) 11:10:04
Haven't anyone spoken in the group for several days?
Itgrit [C/C ++ MFC] (286715286) 11:10:05
Haha
No trace (348259989) 11:10:23
I also think that the Compiler
Itgrit [C/C ++ MFC] (286715286) 11:10:27
We have a holiday in 5.1 groups.
Itgrit [C/C ++ MFC] (286715286) 11:10:32
Why?
Product (466291086) 11:10:37
(++ A) ++ = (a ++ );
A =?
Product (466291086) 11:10:49

Itgrit [C/C ++ MFC] (286715286) 11:11:03
Sinister, haha
Product (466291086) 11:11:06
Hahaha
Product (466291086) 11:11:21
(++ A) ++ = (a ++ );
A =?
Get drunk and laugh at dust □( 464469131) 11:11:59
Why is the result of your question 9 ??
Itgrit [C/C ++ MFC] (286715286) 11:12:00
10
Get drunk and laugh at dust □( 464469131) 11:12:09
How is it calculated ??
Itgrit [C/C ++ MFC] (286715286) 11:12:09
?
Get drunk and laugh at dust □( 464469131) 11:12:13
Can you enlighten me ??
Product (466291086) 11:12:30
4 + 4 + 1
Get drunk and laugh at dust □( 464469131) 11:12:46
Can it be specific ??
Product (466291086) 11:13:07
This answer (++ A) ++ = (a ++ );
A =? How much?
Itgrit [C/C ++ MFC] (286715286) 11:13:09
Evaluate from right to left
Itgrit [C/C ++ MFC] (286715286) 11:13:26
10?
Product (466291086) 11:13:29
My mobile phone brother
Product (466291086) 11:13:33
Hahaha
Product (466291086) 11:13:36

Get drunk and laugh at dust □( 464469131) 11:13:55
But I really don't understand it!
Product (466291086) 11:13:57
Let's take a look at this question.
Product (466291086) 11:14:06

Lander (530468003) 11:14:22
Bored
Product (466291086) 11:14:33
Wait for my class order m
Product (466291086) 11:14:51
Er
Product (466291086) 11:15:37
The instructor is bored.
Itgrit [C/C ++ MFC] (286715286) 11:16:02
Fooled
Product (466291086) 11:16:19
Haha
Cuiwow (157808076) 11:16:55
Can an expression be a left value?
Itgrit [C/C ++ MFC] (286715286) 11:17:15
A ++ returns a value.
Itgrit [C/C ++ MFC] (286715286) 11:17:21
Tragedy
Cuiwow (157808076) 11:17:38
Er, is it?
Product (466291086) 11:17:42

Product (466291086) 11:18:01
Still this ox
Product (466291086) 11:18:14
How can this problem be solved?
Itgrit [C/C ++ MFC] (286715286) 11:21:25
++ A does not return the left value?
Itgrit [C/C ++ MFC] (286715286) 11:21:42
???
Cuiwow (157808076) 11:21:55
Aren't expressions all right values?
Itgrit [C/C ++ MFC] (286715286) 11:22:18
Oh? I made a mistake.
Get drunk and laugh at dust □( 464469131) 11:23:21
Right value left! So what are the left and right values?

In general, the left value is something that can appear on the left of the value assignment symbol, and the right value is something that can appear on the right of the value assignment symbol.

For example:

A = B + 100;

Here, a is the left value, and B + 25 is the right value. The left and right values cannot be exchanged.

B + 100 =;

Everyone can see that this write will not pass the compilation, because the compiler cannot judge the memory address of B + 100, so it cannot operate.

After reading this example, we can make a summary. The left value must be a variable or expression, but its physical location can be determined, while the right value is not necessarily, this is also the difference between them.

There are arrays and pointers in the example where the left value is an expression.

Int array [10];

Int A = 5;

Array [A + 3] = 10; // here, the left value is an array expression.

 

 


In addition, Liotta gave some other tips (left-right translation may be problematic)

Wrong. There are no left or right values!
Translation is harmless,

L-value indicates location, indicating addressable. The "L" in lvalue can be though of as location
In R-value, R refers to read, which indicates read. The "R" in rvalue can be thought of as "read" value.

 

 

Why is the compilation error of a ++ B?
First, when the compiler is reading this language, it will encounter multiple consecutive + S, such as ++, automatic recognition bit (++) ++, that is, the ++ ratio + gives priority to recognition (which can only be said below ).
Second, the ++ operation requires the left value.
A ++ B <=> (A ++) + B
A ++ is okay, but the problem is that a ++ cannot be used as the left value, that is, it cannot be assigned a value, because a ++ returns the value of a for calculation first, then add 1 to the reference of. However, the value of a cannot be the left value. (A ++) error.

+ + Why can a be used as the left value?
The reason is that ++ A adds 1 to the reference of a and then returns the reference of. Of course, the reference of a can be used as the left value and assigned a value.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.