Comma-separated expression

Source: Internet
Author: User

Comma-separated expression
(Eastvc was published on 9:00:20)

The comma-separated expression inherits from C. it is very likely that you often use this expression for-and while-, but in this regard, the language rules are much different from your own intuition. let's take a look at the usage of the comma-separated expression:
A single expression can contain multiple child expressions separated by commas,
Example:
If (++ X, -- y, Cin. Good ())/* Three expressions */
This if condition contains three comma-separated expressions. c ++ ensures that each subexpression is evaluated, but the value of the entire expression only depends on the value of the rightmost expression. Therefore, the above if condition sentence is only used in CIN. good () returns true to true.
The following is another example of commas:
Int J = 10;
Int I = 0;
While (++ I, -- J)
{
/*. J! = When 0, execute the while body repeatedly (Repeat as long as J is not 0 )*/
}
Running result:
I = 10;
J = 0;

Related Article

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.