保存数组地址的指针地址如何相同?

Har*_*iya 1 c c++ arrays pointers

p是一个整数指针,可以保存int变量的地址,但它也有一个内存地址 - 存储它的位置.

a = 1002 指针的数组地址的基地址p = 2008

当我们写:int *p=a; //p points to the base address of array a
int **r=&p; //means *r points to the address of p

如何*r指向地址a,它应该指向地址p.

#include <stdio.h>
void main()
{
    int a[3] = {1, 2, 3};
    int *p =a;
    int **r = &p;
    printf("%p %p", *r, a);
}
Run Code Online (Sandbox Code Playgroud)

Mat*_*Sax 7

printf的不正确.应该将r地址r点打印到:

printf("%p %p", r, a);
Run Code Online (Sandbox Code Playgroud)

通过使用*r,你顺从r(即,跳转到地址r指向),从而打印地址a.