What is the return value of the expression in C?

Source: Internet
Author: User

Today, when I was learning JavaScript, I found a syntax like this (A = "haha ). length; in this way, the length of the Haha string can be output. However, when I use C #, the Branch also uses this expression to read the TXT text. I used to understand this usage well, but now I think this syntax is strange and awkward, so I have a reason to explain it. I will not talk much about the text to explain. Let's look at the following code.

See what results can be returned by an expression.

String S, S1;

S = S1 = "Haha"; // The Code assigns the Haha string to both the S and S1 variables.

S = (S1 = "Haha"); // There is no difference between this code and the above Code. I just added a bracket to the next value assignment statement and changed the priority, but the results are exactly the same,

The code above shows that,A value indicates that the value is returned.

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.