Relationship between pointers and Arrays

Source: Internet
Author: User

1. Char ** P, A [16] [8];

Q: Will P = a cause?ProgramIn the future? Why? Yes, because the type of A is Char (*) [8], p is just a pointer to the pointer and there is no array type information.

Does P [1] [2] and a [1] [2] mean the same? P = A; q a [1] [2] = 1; what is the value of P [1] [2?

We should know that the two-dimensional array is also a one-dimensional layout in the memory.
Therefore, a [1] [2] represents 11th elements.
Let's take a look at P [1] [2] Because the p type is Char ** p, p [1] [2] represents the meaning * (p + 1) + 2), P points to a char *, so p + 1 moves 4 bytes forward, + 2 moves 2 bytes forward, and 6 bytes in total. So is that the same.

2.

C: C is a pointer, and it must not be 0.

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.