03InputLarge

# 03InputLarge - CMSC 106 Lecture Set#3 Set Started Monday...

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

9/12/2011 1 CMSC 106 Lecture Set #3 Set Started: Monday, September 12, 2010 Common Operators s Arithmetic operators : s Unary negation: -x s Addition/subtraction: x+y x-y s Multiplication/division: x*y x/y s Division between integer types truncates to integer: 23/4 5 s x%y returns the remainder of x divided by y : 23%4 3 s Division with real types yields a real result: 23.0/4.0 5.75 s Same rules as algebra for precedence and associatively s Comparison operators : s Equality/inequality: x == y x != y s Less than/greater than: x < y x > y s Less than or equal/greater than or equal: x <= y x >= y (ex: operators.c, truncation.c and rounding.c)

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

View Full Document
2 The Assignment Operator s variable = value s LHS must indicate space in memory s RHS must have value s should be of the same type s calculated before assignment s Both: A Statement and An Arithmetic Operator s changes the value of the space indicated by the LHS s returns the value that is assigned s right to left associative (ex: assignments.c)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

03InputLarge - CMSC 106 Lecture Set#3 Set Started Monday...

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

View Full Document
Ask a homework question - tutors are online