C language (3) -- operator & amp; Expression & amp; Statement

Source: Internet
Author: User

The job of a computer is to perform a series of operations. The C language provides different operators for different operations!

1. Operators

. Basic Operators

Arithmetic Operator: +-*/% + + --

Value assignment operator: =

Comma OPERATOR :,

Relational operators: <><=>=! =

Logical OPERATOR: & |!

Conditional OPERATOR :? :

. Bit Operator

Bit logical operators :~ & | ^ (Exclusive or)

Offset OPERATOR: >><

2. Operation priority

When multiple operations are used together, we need to know the sequence of operations. Otherwise, different values may be obtained! When relational operations, value assignment operations, logical operations, and arithmetic operations are mixed, they are as follows:

! > Arithmetic operation> relational operation> & amp; and |> value assignment operation

Note: among all operators, the comma operator has the lowest priority. The assignment operator has a higher priority than the comma operator.

3. Expressions and their values

. Expressions are composed of operators and operands. The simplest expression is a separate operand. Based on this, you can create a complex expression.

Different expressions have different expression values, such:

Value assignment expression ---- the value is the same as the value obtained by the = variable.

Arithmetic expression ---- the value is the structure of arithmetic operation

Relational Expression ---- the value is 1 or 0

Logical expression ---- the value is also 1 or 0

Comma expression ---- the value of the last expression

4. Statements

A statement (statement) is a complete computer command. In C, the statement is identified by a semicolon at the end. A set of different statements forms a program.

The basic statements in C language can be divided into declaration statements, expression statements, function call statements, control statements, compound statements, and empty statements.

      

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.