The relationship between a pointer and a two-dimensional array

Source: Internet
Author: User

Pointers refer to multidimensional arrays

int a[3[4] = {{1,3,5,7},{9,One, },{, (+),+, +}};
Two- dimensional arrays
A[0] == 1 2 5 7
A[1] == 9 11 13 15
A[2] == 17 19 21st 23

OK, two-dimensional arrays in our eyes, the equivalent of three one-dimensional arrays; A represents the first address of a two-dimensional array. In a two-dimensional array, we need to pay special attention to the address that a+1 points to is actually a[1].

We set the "int" type in the example, and each INT in 32-bit vs represents 4 bytes. Suppose: The first address of "a" is 2000, then the address of "a+1" is 2000+4*4 = 2016;

Relationships between pointers and two-dimensional arrays

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.