Crazy C language Notes (pointers)

Source: Internet
Author: User

Pointer Chapter

4. Properties of Array A

int A[3][4] = {{1,3,5,7},{9,11,13,15},{17,19,21,23}}

int data in the Keil compilation environment, accounting for 2 bytes of memory

Representation

Meaning

Address

A

Two-dimensional array name, pointing to an array a[0], which is the 0 header address

Set 2000

A[0], * (a+0), *a

0 row 0 Column element address

2000

A+1,&A[1]

1 row 0 Column element address

2008

A[1], * (a+1)

Address of 1 Rows 0 column element a[1][0]

2008

A[1]+2, * (a+1) + 2, &[1][2]

1 row 2 column (i.e. a[1][2]) element address

2012

* (a[1]+2), * (* (a+1) +2), a[1][2]

1 rows 2 columns (i.e. a[1][2]) element values

Element 13

(1) Why does * (a+1) indicate the first address of a line?

Answer: * (a+x) ==a[x]; The two are equivalent.

(2) How does the C language cause * (A+X) and a[x] to be completely equivalent?

A: In an array, *a is a[0],a+1 pointing a[1],a+2 to a[2],a+3 pointing to a[3], which means

* (a+1), * (a+2), * (A+3) respectively a[1], a[2], a[3]. In the actual code generation mechanical code relationship, two effects are completely equivalent.

Next Update Time 2014.09.12

New understandings and insights can be exchanged with each other and learn together

Crazy C language Notes (pointers)

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.