Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Several ways to define arrays in C language
Several ways to define arrays in C language

Definition of array

Array refers to a collection used to store the same type of data. An array is actually a series of variables. Arrays can be divided into one-dimensional arrays and two-dimensional arrays according to their use. Arrays and multidimensional arrays

Methods of array definition

There are four forms of array definition, namely:

(1) Type name [] Array name ;

(2) Type name [] array name = {initial value list};

(3) Type name [] array name = new type name [array size];< /p>

(4) Type name [] array name = new type name [array size] {initial value list};

Data type: refers to the data type of the array element, common There are integer, floating point, and character types, etc.

Array name: It is used to unify the name of this group of elements of the same data type, and its naming rules are the same as those of variables