pointer arrays and Arrays pointers

Source: Internet
Author: User

pointer array:array of pointers, which is used to store pointers to arrays, which are arrays of elements that are pointers

array pointer:A pointer to an array, which is a pointer to the array

Array of pointers: Each element in the array holds the address example: int *a[4];

Array pointers: An array of examples of values that are specific to the type: Int (*a) [4];


We compare the above two examples with the int *b, respectively.

1:int *a[4] Because the priority of the * is lower than [], so the expression can be written as: int * (a[4]);

We also convert int *b to int * (B[1]), which looks a bit like an int * (a[4]);

int * (a[1]) can only store an address of an integer variable, then int * (A[4]) is the only address that can store 4 shaping data.


2:int (*a) [4] () has the same precedence as [], we compare it with int B, first int A can be written as int b[1];

is int *&a[1]; int (*&b) [1]; Do we compare it to int (*a) [4] and find out? &b and A are the same nature, except that the &B step is an int type, The step of a is 4 of the size of the int type!

This article is from the Web Learning Summary blog, so be sure to keep this source http://8947509.blog.51cto.com/8937509/1579340

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