Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'microsoft visual c_1', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Introduction to C C applies lazy also called short-circuit evaluation which means that it will not evaluate more parts of the expression than is necessary to evaluate its value. In the following example the evaluation of the expression is completed when the left expression i 0 is evaluated to false. If the left expression is false the whole expression must also be false because it needs both the left and right expressions to be true for the whole expression to be true. This shows that the right expression 1 i 1 will never be evaluated and the division with zero will never occur. int i 0 bool b i 0 1 i 1 false Bitwise Operators An integer value can be viewed as a bit pattern. Our familiar decimal system has the base ten it can be marked with an index 10. 23410 2.100 3.10 4.1 2.102 3.101 4.100 An integer value can also be viewed with the binary system it has the base two. A single digit viewed with the base two is called a bit and the integer value is called a bit pattern. A bit may only take the values one and zero. 10102 1.23 0.22 1.21 0.20 1.8 0.4 1.2 0.1 8 2 0 There are four bitwise operations in C inverse and or and exclusive or A . Exclusive or means that the result is one if one of its operand bits but not both is one. They all operate on integral values on bit level that is they examine each individual bit of an integer value. 101010102 100101102 101010102 100101102 A 101010102 100101102 100101102 100000102 101111102 001111002 011010012 int a 170 101010102 int b 150 100101102 int c a b 100000102 13010 int d a b 101111102 19010 int e a A b 001111002 6010 int f b 011010012 10510 24 Chapter 1 An integer value can also be shifted to the left or to the right . Do not confuse these operators with the stream operators they are different operators that happen to be represented by the same symbols. Each left shift is equivalent to doubling the value and each right shift is equivalent to integer dividing the value by two. Overflowing bits are dropped for unsigned .