Meaning one-dimensional and two-dimensional arrays of arrays

1. The one-dimensional array
int arr [4]; represents define a one-dimensional array containing four elements, an array named arr.
arr integer data type is a pointer, corresponding to P * int;
arr + + 1. 1 is equivalent to a pointer, a pointer to an integer data types.
arr [0] represents an array element arr, is int type.
arr [0] +1 indicates arr array to the first element plus 1, is int type.

2. The two-dimensional array
int brr [3] [4] ; represents define a two-dimensional array of three rows and four columns, array named brr.
The first row elements brr default point two-dimensional array (Note: two-dimensional array instead of a two pointer array name, but a pointer to an array, referred to as the pointer array.), data type equal to int (* p) [4 ]; (Note: "()" can not be omitted, "[]" is greater than the priority of "*").
brr + 1 + 1 is equivalent to a pointer array, a second line to an array, corresponding to the data type int (* P) [. 4];
BRR [0] indicates a pointer to the first element of the two-dimensional array of points, the first retention element address, data type corresponds to P int *;
BRR [0] +1 +1 pointer, the first pointer indicates the second row of the two-dimensional array of elements, equal to the same data type int * P;
BRR [0] [0] represents the first element of the two-dimensional array, and the subscript 0 for the first row 0, the data type to int.
Here Insert Picture Description

Published 30 original articles · won praise 32 · views 968

Guess you like

Origin blog.csdn.net/cleverlemon/article/details/102783024