1. Summary

1. Summary

1.1. The data type of C

Basic type, constructor type, pointer type, null type

1.2. Classification and characteristics of basic types

Type descriptor Byte Numerical range
Character type char 1 0~255
Basic integer int 4 -214783648~214783647
Short integer 2 -32768~32767
Long integer 8 -922337203685477808~922337203685477807
Unsigned 4 0~4294967295
Unsigned long 8 0~18447440737039551615
Single precision real float 4 3/4E-38~3/4E+38
Double precision real type 8 1/7E-308~1/7E+308

1.3. Constant suffix

L or l long integer

U or u unsigned number

F or f floating-point number

1.4. Constant type

Integer, long integer, unsigned number, floating-point number, character, string, symbol constant, escape character.

1.5. Data type conversion

1.5.1. Automatic conversion

In mixed operations of different types of data, the system automatically implements the conversion from a few byte type to a multi byte type. When different types of quantities are assigned to each other, the system automatically converts them, converting the type on the right side of the assignment number to the type on the left side.

1.5.2. Force Conversion

The conversion is completed by the cast operator.

1.6. Operator priority and associativity

Generally speaking, monocular operators have higher priority, while assignment operators have lower priority. Arithmetic operators have higher priority, while relational and logical operators have lower priority. Most operators have left associativity, including unary operators, triplet operators, and assignment operators.

1.7. Expression

An expression is a formula composed of operators connecting constants, variables, and functions. Each expression has a value and type. Expression evaluation is performed in the order specified by the priority and associativity of operators.

1.8. Expression

  1. Arrays are the most commonly used data structures in programming. Arrays can be divided into numerical arrays (integer groups, real number groups), character arrays, as well as pointer arrays, structure arrays, etc. that will be introduced later.

  2. Arrays can be one-dimensional, two-dimensional, or multi-dimensional.

  3. The array type description consists of three parts: type descriptor, array name, and array length (number of array elements). Array elements are also known as subscript variables. The type of array refers to the type of value taken by the index variable.

  4. The assignment of an array can be achieved through three methods: array initialization assignment, input function dynamic assignment, and assignment statement assignment. Numerical arrays cannot be assigned, inputted, or outputted as a whole using assignment statements, but must be operated on individually using loop statements.