The distinction between compound sentences and operators

Time:2021-4-19

The concept and usage of compound sentence

In some cases, the statement must be combined with other statements to achieve its functions. The code in curly braces {} is called a compound statement.

For example:

int a,b;
if (a == b) 
    ... / * this part of the code is used with the if function, so it is placed in curly brackets. */
}

In order to increase the readability of the program, the code used to realize the same function can be put in curly brackets when necessary. For example:

int a=1,b=2,c;
if (a < b) {
    printf("a = b");
    {
        c = a
        printf("%d",c)
    }
}

This usage is generally unnecessary and can be indicated by combining appropriate blank lines and comments.

Left and right values and multivariate operators

For example:

int a,b,c,d;
c = a + b;
//D = C = a + B; / * this is a bad habit*/

Don’t use the notation

d = c;
c = a + b;

It should be understood as

d = a + b;
c = a + b;

This can lead to errors, so try to avoid it.

Here, the plus sign + and the equal sign = are operators and binary operators. Because they all have two operands, C on the left and a on the right of the equal sign. Because of their position, the left part of the operator is called the left value, and the right part is called the right value.
In all operators, the same symbol may have different meanings, for example:

C = a * B / * take the product of a and B*/
C = * (a) / * pointer to a*/

The first method has two operands, binary operator, so it is multiplication operator; the second method has one operand, so it is pointer operator.

Recommended Today

Review of SQL Sever basic command

catalogue preface Installation of virtual machine Commands and operations Basic command syntax Case sensitive SQL keyword and function name Column and Index Names alias Too long to see? Space Database connection Connection of SSMS Connection of command line Database operation establish delete constraint integrity constraint Common constraints NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY DEFAULT […]