Download Authors
Transcript
3.4.5 Variables A variable is a storage location and has an associated type. A variable always contains a value that is assignment compatible with its type. Moreover, every variable in a program must have a value before its value is used. 3.5 Expressions The precedence of expression operators is the same as the order of the major subsections of this section, the highest precedence first. Within each subsection, the operators have the same precedence. Left- or right-associative is specified in each subsection for the operators discussed therein. 3.5.1 Primary Expressions Primary expressions are identifiers, constants, strings, or expressions in parentheses. Primary-expression: Identifier-primary | constant | “true” | ”false” | “null” | New-expression | (Assignment-expression) An identifier is a primary expression, provided that it has been suitably declared as discussed below. Its type is specified by its declaration. A constant is a primary expression, with either type int or type string. New-expression is an initialization expression that declares the instance of an array object. A parenthesized assignment expression is a primary expression that contains operators. 3.5.2 Multiplicative Operators The multiplicative operators *, /, % group left-to-right. Multiplication-expression: Multiplication-expression * Postfix-expression | Multiplication-expression / Postfix-expression | Multiplication-expression % Postfix-expression