C language array independent learning

How to define an array

The general form of defining a one-dimensional array is:
type character array name [constant expression]
, for example: int a[10];
10 elements a[0],...a[9].
Note: If an array is defined in a called function (not including the main function), its length can be a variable or a non-const expression.
For example:
void func(int n)
{ int a[2*n]; }


One-dimensional array initialization

int a[10]={0,1,2…9};

How to define a two-dimensional array

Type identifier array name [constant expression] [constant expression]
For example: float a[3][4] defines a as a 3×4 (3 rows and 4 columns) array.

Guess you like

Origin blog.csdn.net/junjunjunjuna/article/details/118356742