{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

05ConditionalsSmall

# 05ConditionalsSmall - CMSC 106 Lecture Set#5 Set Started...

This preview shows pages 1–3. Sign up to view the full content.

1 CMSC 106 Lecture Set #5 Set Started: Friday, September 23, 2011 “boolean” statements square6 values possible: true and false square6 never both and never neither square6 Does not exist as a type in C square6 many people use symbolic constants to define them so they look like they exist square6 In C square6 0 is false square6 any other value is true Important Operators square6 Relational Operators square6 Equality: x == y square6 Inequality: x != y square6 Less than: x < y square6 Greater than: x > y square6 Less than or equal to: x <= y square6 Greater than or equal: x >= y square6 Logical Operators square6 And: a && b square6 Or: a || b square6 Not: !a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Operator Precedence Operator Associativity !, unary -, ++, -- right to left *, /, % left to right +, - left to right <, <=, >, >= left to right ==, != left to right && left to right || left to right =, +=, -=, *=, /= right to left * note – the unary increment and decrement operators have high precedence even when used as postfix but the time of operation doesn’t get used until after Conditions and Expressions square6 0 is considered 'false' square6 any other value is considered 'true' square6 equality or relational operators square6 (< , <=, >, >=, ==, !=) square6 produces result 0 or 1 The Logical Operators square6 && (and) (binary operator) square6 || (or) (binary operator)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}