c++ - '**' 在 C 中是什么意思?

标签 c++ c syntax pointers operators

一个对象开头有两个星号是什么意思?

**variable

最佳答案

在声明中,它意味着它是一个指向指针的指针:

int **x;  // declare x as a pointer to a pointer to an int

使用它时,它会尊重它两次:

int x = 1;
int *y = &x;  // declare y as a pointer to x
int **z = &y;  // declare z as a pointer to y
**z = 2;  // sets the thing pointed to (the thing pointed to by z) to 2
          // i.e., sets x to 2

关于c++ - '**' 在 C 中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2893129/

相关文章:

c++ - 更改指针指向的对象,但对象不会更改

我可以修改共享库文件以与我的可执行文件一起正常工作吗

c++ - 全局 const 变量的 G++ 名称修饰

javascript - var functionName = function() {} vs function functionName() {}

c++ - 使用 Interlocks 进行线程同步并保持缓存一致性

c++ - 如何编辑流式字符数组中的元素

c - 如何对字符串问题进行模运算?

excel - 试图在单元格中找到精确字符串的下一个实例

带有可选参数的 Groovy 方法

c++ - 在 MFC DLL 中导出返回 vector 的函数