pointer arrays and array pointers

Source: Internet
Author: User
An array of pointers: First it is an array, the elements of the array are pointers, and the number of bytes in the array is determined by the array itself . It is the abbreviation for "array of stored pointers". Second, array pointers: First it is a pointer to an array. The 32-bit system will always be 4 bytes, as to how many bytes it points to, not known. It is the abbreviation for "pointers to arrays". Eg: Which of the following is an array pointer, which is an array of pointers: a), an int *p1[10];--> pointer array b), an int (*P2) [10];--> array Pointer Resolution: First, it is necessary to understand the priority problem between a symbol. The priority of "[]" is higher than "*" . P1 is first combined with "[]" to form the definition of an array, with the array named P1, and int * Decorated with the contents of the array, that is, each element of the array. So, this is an array that contains 10 pointers to data of type int, that is, an array of pointers. As for P2, it is better understood that the precedence of "()" here is higher than "[] ", "*" and P2 constitute a pointer definition, the pointer variable is named P2, and int modifies the contents of the array, that is, each element of the array. The array does not have a name here and is an anonymous array. So now we know that P2 is a pointer to an array that contains 10 data of type int, that is, an array pointer.

pointer arrays and array 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.