Basic operators and expressions of the C language

Source: Internet
Author: User
Tags arithmetic arithmetic operators bitwise expression logical operators

Type, priority, and binding of C-language operators

The number of operators and expressions in the C language is rare in advanced languages. It is the rich operators and expressions that make the C language function perfect. This is also one of the main features of C language.

The C language operator not only has different priority, but also has one characteristic, is its binding nature. In an expression, the order in which the operands participate is not only governed by the precedence of the operator, but also by the binding of the operators, so as to determine whether to operate from left to right or from right to left. This binding is not the same as the operators of other advanced languages, thus increasing the complexity of the C language.

Types of Operators C-language operators can be grouped into the following categories:

1. Arithmetic operators

For all kinds of numerical operations. Including plus (+), minus (-), multiply (*), in addition to (/), residual (or modulo operation,%), self-increase (+ +), since minus (-) a total of seven kinds.

2. Relational operators

For comparison operations. Includes six species greater than (>), less than (<), equal to (= =), greater than or equal (>=), less than or equal (<=), and not equal to (!=).

3. Logical operators

Used for logical operations. including with (&&), or (| |), NON (!) Three species.

4. Bitwise operator operator

The amount of the participating operation, which is calculated by bits. Includes bits and (&), bits or (|), bits (~), bitwise XOR, or (^), left (<<), right Shift (>>) six kinds.

5. Assignment operator

For assignment operations, it is divided into simple assignment (=), compound arithmetic Assignment (+=,-=,*=,/=,%=) and compound bit operation Assignment (&=,|=,^=,>>=,<<=) three class altogether 11 kinds.

6. Conditional operators

This is a three-mesh operator for conditional evaluation (?:).

7. Comma operator

Used to combine a number of expressions into an expression (,).

8. Pointer operators

For content (*) and address (&) two operations.

9. Find the number of bytes operator

The number of bytes (sizeof) used to compute the data type.

10. Special Operators

with parentheses (), subscript [], member (→,.) and several.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.