05ConditionalsLarge

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

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

1 CMSC 106 Lecture Set #5 Set Started: Friday, September 23, 2011 “boolean” statements s values possible: true and false s never both and never neither s Does not exist as a type in C s many people use symbolic constants to define them so they look like they exist s In C s 0 is false s any other value is true

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

View Full Document
2 Important Operators s Relational Operators s Equality: x == y s Inequality: x != y s Less than: x < y s Greater than: x > y s Less than or equal to: x <= y s Greater than or equal: x >= y s Logical Operators s And: s Or: a || b s Not: !a 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 s 0 is considered 'false' s any other value is considered 'true' s equality or relational operators s (< , <=, >, >=, ==, !=) s produces result 0 or 1 The Logical Operators s (and) (binary operator) s || (or)

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

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

## This note was uploaded on 01/12/2012 for the course CMSC 106 taught by Professor Staff during the Fall '07 term at Maryland.

### Page1 / 9

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

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online