C语言英文版课件课件精品
Introduction to Computer(C Programming) Software College , Northeastern University 2007,9 3.1 introduction C operators can be classified into a number of categories. They include: Arithmetic operators. Relational operators. Logical operators. Assignment operators. Increment and decrement operators. Conditional operators. Bitwise operators. Special operators. 3.2 Arithmetic operators Operator Meaning + Addition or unary plus - Subtraction or unary minus * Multiplication / Division % Modulo division Example 3.1 The Program shows the use of integer arithmetic to convert a given number of days into months and days. 3.3 Relational Operators C supports six relational operators in all: Operators Meaning < is less than <= is less than or equal to > is greater than >= is greater than or equal to == is equal to != is not equal to Relational Operator Complements 3.4 Logical Operators C has the following three logical operators: && meaning logical AND || meaning logical OR ! meaning logical NOT Truth Table Op_1 Op_2 Value of the Expression op_1&&op_2 op_1||op_2 Non_zero Non_zero 1 1 Non_zero 0 1 1 0 Non_zero 1 1 0 0 1 1 3.5 Assignment Operators C has a set of ‘shorthand’ operators of the form: v op =exp; where v is a variable, exp is an expression op is a C binary arithmetic operator