CS110_02b_mathOps

# It shows your intentions casting and stops some

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: nd j to type float When in doubt, USE CASTING. It shows your intentions, CASTING and stops some subtle bugs before they start! 24 Expressions Statements Expressions are often NESTED: (((n+5)<=a) && q) this is an expression. But is this a statement? (have you read Chapter 3 yet?) (((n+5)<=a) && q); Why, or why not? 25 Expressions Statements (((n+5)<=a) && q); A `statement' in C is: zero or more expression(s) terminated by a semicolon ; For each expression (each red circle), C makes a (hidden) temporary variable (Recall: some expressions have side-effects) Semicolon means: `Done! Destroy all temporary variables!' 26 Statements Statement An action to be performed by the program; and A set of expressions, possibly nested. Statements always terminate in a semicolon Examples: counter = 3; // an assignment statement. printf("Hello"); // message-printing statement. counter = 3 // NOT a statement: this is just an // expression. It will become a statement when we // add a semi-colon at the end. 27...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online