05ConditionalsLarge

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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online