Lecturer 14 More C Operators

Lecturer 14 More C Operators - Lecture14:MoreCOperators

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

View Full Document Right Arrow Icon
FAST, National University of Computer and Emerging Sciences, Islamabad 1 Lecture 14:  More C Operators Course: Programming For Engineers-1
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 Reference Ch.2 of the Text Book
Background image of page 2
3 Assignment Operators Assignment expression abbreviations Addition assignment operator c = c + 3; abbreviated to c += 3; Statements of the form variable = variable operator expression; can be rewritten as variable operator= expression; Other assignment operators d -= 4 (d = d - 4) e *= 5 (e = e * 5) f /= 3 (f = f / 3) g %= 9 (g = g % 9)
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Increment and Decrement Operators Increment operator ( ++ ) - can be used instead of c += 1 or c=c+1 Decrement operator ( -- ) - can be used instead of c -= 1 or c=c-1 Pre-increment When the operator is used before the variable ( ++c or –-c ) Variable is changed, then the expression it is in is evaluated. Post-increment When the operator is used after the variable ( c++ or c-- ) Expression the variable is in executes, then the variable is changed.
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Lecturer 14 More C Operators - Lecture14:MoreCOperators

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

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