03InputLarge

03InputLarge - 9/12/2011 CMSC 106 Lecture Set #3 Set...

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

View Full Document Right Arrow Icon
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)
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 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)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

03InputLarge - 9/12/2011 CMSC 106 Lecture Set #3 Set...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online