Summary

1) C language is divided into single-line comments and multi-line comments: single-line comments starting with // line text, may not be supported by the compiler; Multiline comments on all text between /* and */. Nesting is not supported

2) The comma expression has the lowest precedence; A comma expression executes the statement from left to right; The value of the comma expression is the value of the rightmost statement

3) Preposition ++, self-increment first, and then value; After ++, take the value first, and then increment; The — operator is the same as ++. The ++ and — operators are combined from left to right

1, comments,

Comments in C language are divided into “single-line comments” and “multi-line comments”; Single-line comments :(Single-line comments may not be supported by the compiler) The line of text starting with **//** Multi-line comments :(Multi-line comments do not support nesting) All text between /* and */

2. A comma expression

  • The comma (,) is a special kind of operator
  • A comma can join multiple statements together to make a single statement
  • Syntax: statement 1, statement 2, statement 3… The statements n

Note:

  • A comma expression has the lowest precedence
  • A comma expression executes the statement from left to right
  • The value of the comma expression is the value of the rightmost statement

3, increment ++ and decrement — operators

3.1 the front

The preceding ++ (–) : increment (decrement), and then value can be expressed using a comma expression as follows:

++v;  <->  (v = v + 1, v)
--v;  <->  (v = v - 1, v)

3.2 the rear

After ++ (–) : value first), then increment (decrement) using comma expression can be expressed as follows:

v++;  <->  (v = v + 1, v - 1)
--v;  <->  (v = v - 1, v + 1)

This paper is summarized from the “C Language Introduction Course” by Tang Zuolin, teacher of “Ditai Software College”. If there are mistakes or omissions, please correct.