TAILIEUCHUNG - Understanding Operators

Sự hiểu biết sử dụng Bạn sử dụng toán tử để kết hợp với nhau thành các biểu thức toán hạng. Mỗi nhà khai thác có ngữ nghĩa riêng của nó phụ thuộc vào loại nó làm việc với. | Understanding Operators You use operators to combine operands together into expressions. Each operator has its own semantics dependent on the type it works with. For example the operator means add when used with numeric types or concatenate when used with strings. Each operator symbol has a precedence. For example the operator has a higher precedence than the operator. This means that the expression a b c is the same as a b c . Each operator symbol also has an associativity to define whether the operator evaluates from left to right or from right to left. For example the operator is right-associative it evaluates from right to left so a b c is the same as a b c . NOTE The right-associativity of the operator allows you to perform multiple assignments in the same statement. For example you can initialize several variables to the same value like this int a b c d e a b c d e 99 The expression e 99 is evaluated first. The result of the expression is the value that was assigned 99 which is then assigned to d c b and finally a in that order. A unary operator is an operator that has just one operand. For example the increment operator is a unary operator. A binary operator is an operator that has two operands. For example the multiplication operator is a binary operator. Operator Constraints C allows you to overload most of the existing operator symbols for your own types. When you do this the operators you implement automatically fall into a well-defined framework with the following rules You cannot change the precedence and associativity of an operator. The precedence and associativity are based on the operator symbol for example and not on the type for example int on which the operator symbol is being used. Hence the expression a b c is always the same as a b c regardless of the type of a b and c. You cannot change the multiplicity of an operator the number of operands . For example the symbol for multiplication is a binary operator. If you declare a operator for your .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.