对于:
int *a;
a
是可以存储整数的地址。
&a
是存放a的地址。
那么,&a
存放在哪里呢?
而且,&(&a)
存储在哪里?
而且,&(&(&a))
存储在哪里?
这种地址存储在哪里停止?
最佳答案
如果你没有显式地写&a
,它就不会被存储在任何地方。如果您确实写入,那么地址将被计算并存储在未命名变量(临时)或您编写的命名变量中。
例如:
functionCall( &a ); // address will be in a temporary variable used for passing the parameter
int** b = &a; // address will be stored in variable b
otherFunctionCall( &&a ); // illegal, since &a is an expression operator & can't be applied to it
关于C指针问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1109847/