Two-dimensional array,

Source: Internet
Author: User

Two-dimensional array,
Two-dimensional array

 

1,

The address of a [0] is the same as that of a [0] [0], because a [0] [0] is a [0] (because it is a two-dimensional array, so now a [0] is the first address of a pointer pointing to a one-dimensional array.

The address of a is the same as that of a [0] because a [0] is the first letter of a array.

The value of a [0] is the same as the address because a [0] is an array (also a pointer) and points to the address of the first element.

We can see the following one-dimensional array.

 

 

2. memory usage of two-dimensional arrays

Int a [3] [4] is a two-dimensional array consisting of three rows and four columns. It contains 12 units, each of which is 4 bytes and each byte is 8 bits, and the 12 units are continuous.

 

Two-dimensional array memory Representation

 

 

Note:

A + 1 = the address of a [1], that is, the address of a [1] [0] instead of the address of a [0] [1]

A [0] + 1 = address of a [0] [1]

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.