Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Ask the question of C language: the independent variable is the two-dimensional integer array name t [] [N], which is called with fun(t), so when defining the function,
Ask the question of C language: the independent variable is the two-dimensional integer array name t [] [N], which is called with fun(t), so when defining the function,
Int t[][N] and int (*t)[N] have the same meaning, indicating that t is a pointer.

Point to an integer array containing n elements.

Now write a small program to output the elements of a two-dimensional array line by line.

# include & ltstdio.h & gt

# include & ltconio.h & gt

# Define the number of n 5//columns

Void printarray (int (* a) [n], int rows)// Try to change it to int a[][N] after running.

{

for(int I = 0; I< line; i++)

{

for(int j = 0; j & ltn; j++)

{

printf("%d ",a[I][j]);

}

printf(" \ n "); //Go to the next line

}

}

int main()

{

int a[3][5]={{ 1,2,3},{3,4,5,6},{5,6,7,8,9 } };

//int * * b = a; This assignment doesn't work because the type of A is int*[5].

//int(* b)[5]= a; This can run through

printArray(a,3);

Returns 0;

}

The compiler I use is C-free. I hope this explanation is useful to you.