Ch4 - Click to edit Master subtitle style prepared by NI...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Click to edit Master subtitle style 7/23/2008 prepared by NI, edited by MAF CSEB 114: Principle of programming Chapter 4: Basic C Operators 7/23/2008 prepared by NI, edited by MAF Objectives prepared by NI, edited by MAF In this chapter, you will learn about: Arithmetic operators Unary operators Binary operators Assignment operators Equalities and relational operators Logical operators Conditional operator 7/23/2008 prepared by NI, edited by MAF Arithmetic Operators I prepared by NI, edited by MAF In C, we have the following operators (note that all these example are using 9 as the value of its first operand) Operation Operator Operand Value After Addition + 2 11 Subtraction- 2 7 Multiplication * 2 18 Division / 3 3 Increment ++ + 10 Decrement--- 8 Modulus % 2 1 7/23/2008 prepared by NI, edited by MAF Arithmetic Operators II prepared by NI, edited by MAF There are 2 types of arithmetic operators in C: unary operators operators that require only one operand. binary operators. operators that require two operands. 7/23/2008 prepared by NI, edited by MAF Unary Operator prepared by NI, edited by MAF The first assigns positive 3 to a The second assigns the negative value of a to b. i++ is equivalent to i = i + 1 i-- is equivalent to i = i-1 C Operation Operator Example Positive + a=+3 Negative- b=-a Increment ++ i++ Decrement-- i-- 7/23/2008 prepared by NI, edited by MAF PRE- / POST-Increment prepared by NI, edited by MAF It is also possible to use ++i and --i instead of i++ and i-- However, the two forms have a slightly yet important difference....
View Full Document

This note was uploaded on 06/01/2011 for the course ECON 101 taught by Professor Yip during the Spring '11 term at Al-Quds University.

Page1 / 19

Ch4 - Click to edit Master subtitle style prepared by NI...

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

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