![]() This example works as it does * because return is a keyword, not a function call. */ return 1, 2, 3 /** * Returns 3, not 1, still for same reason as above. ![]() */ return a = 4, b = 5, c = 6 /** * Returns 3, not 1, for same reason as previous example. * Results: a=1, b=2, c=3, i=3 */ int a = 1, b = 2, c = 3 int i = ( a, b, c ) /** * Returns 6, not 4, since comma operator sequence points following the keyword * return are considered a single expression evaluating to rvalue of final * subexpression c=6. ![]() * Assigns value of c into i, discarding the unused a and b values. The comma operator separates expressions (which have value) in a way analogous to how the semicolon terminates statements, and sequences of expressions are enclosed in parentheses analogously to how sequences of statements are enclosed in braces: (a, b, c) is a sequence of expressions, separated by commas, which evaluates to the last expression c while /** * Commas act as separators in the first line and as an operator in the second line.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |