C指针问题

标签 c pointers

对于:

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/

相关文章:

c - 如何从 ARM 汇编调用 C 函数?

c - 使用atoi,从字符串中获取整数

pointers - 在 Go-lang 中返回对结构的引用

c - 阻塞接受

c - 只计算一次宏参数

c - C中的指针算术和 "generic"

c - c中的表达式

c - 使用指针访问嵌套结构中的成员。等效箭头运算符

C Incompatible pointer type 消息似乎列出了预期和实际的相同指针类型

c - C 中的 fscanf() 对 float 进行四舍五入