Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language defines a one-dimensional array, and the elements are not initialized. What is the default value of array elements?
C language defines a one-dimensional array, and the elements are not initialized. What is the default value of array elements?
The initialization default value of one-dimensional array elements is related to the defined array type, and the uninitialized default values of different arrays are different.

Default values of several common arrays:

Integer: 0

Floating point type: 0.0

Character type: 0 or "\u0000" (instead of "0")

Boolean value: false

Application data type: empty

Extended data:

Declare a fixed-size array

There are three ways to declare a fixed-size array, which method depends on the valid range of the array:

1, set a public array, and declare the array with public statements in the declaration part of the module.

2. Establish a module-level array, and declare the array with a Private statement in the declaration part of the module.

3. Create a local array, and declare the array with private statements in the process.

Baidu Encyclopedia-Array