Detailed Explanation of "C Language Level 2 Pointer (Pointer Pointer to Pointer)" Review of Computer Science College Upgrade (First Draft)

Detailed explanation of C language secondary pointer (pointer to pointer)

" Pointer " can point to a common type of data, such as: int, doublechar, etc., and can also point to a " pointer type of data ", such as: int*, double*, char*, etc.

If a pointer points to another pointer , we call it a " secondary pointer ", or a " pointer to a pointer ".

Suppose there is a variable a of int type, p1 is a pointer variable pointing to a, and p2 is a pointer variable pointing to p1

Their relationship is as follows:

int a = 100;

int *p1 = &a;

int **p2 = &p1;

Because " pointer variable " is also a kind of variable , it will also occupy " storage space ", and you can also use " & to obtain its address ".

The C language does not limit the number of levels of pointers. For each additional level of pointers, an asterisk must be added when defining pointer variables *

For example: <

Guess you like

Origin blog.csdn.net/weixin_51563198/article/details/122784947