Pointer to array pointer, pointer array, and pointer

Source: Internet
Author: User

Array pointers: First look at the name "array pointer" is "pointer", it can be understood as a pointer. But there is an array in front of it, that is, it points to an array.
See-"Int (*p) [Ten], we parse from an expression, because () has a high priority,so *p on behalf of P meansThe PIN, also int is modified by [10] to indicate
An array containing 10 int, so p represents the first address of an array with 10 elements. Maybe you should define an array pointer like this:        Int (*) [ten] P
      because according to our method, the first is the type, followed by the variable, so the previously defined type is an array pointer,   It is followed by the name of the pointer. But the compiler doesn't think so, because it's too ugly to write. So it was written.                  Int (*p) [Ten]  array of pointers:Pointer array, so the name of the pointer array is an "array", so, but the contents of the array is a pointer, so we           int *p[10]    This can be understood here, because [] the priority is higher than * , so first the p and [] are combined into an array, so the array name
is P, and the following int * Modifies the contents inside, resulting in an array containing 10 int*.



Pointer to pointersThe pointer is a pointer to what is stored inside the pointer or a pointer address.


array pointer Pointer array pointer pointer to the relationship of the shape participation argument

The " array name is rewritten as a pointer parameter" rule is not recursively defined. Arrays of arrays are rewritten as "pointers to arrays" instead of " pointer pointers":

Parameters that are matched by an argument

Array of array char c[8][10];          CHAR (*) [10]; Array pointers

Pointer array char *c[10];               Char **c; Pointer to pointers

Array pointer (row pointer) char (*C) [10];        char (*C) [10]; does not change

Pointer to the pointer char **c;               Char **c; does not change


Source: >  







From for notes (Wiz)

Pointer to array pointer, pointer array, and pointer

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.