c pointer assignment to pointer to pointer 是什么意思

标签 c pointers

我有一个代码片段很难理解。

char *c;   // c is uni dimensional table ( single row )

char **p ; // p is a two dimensional table 

**p = *c;  // what does this mean ?

当我执行上述作业时, c 是否被复制为 p 的第一行?

或者 c 被复制为 p 的第一列?

最佳答案

**p = *c; // what does this mean ?

When I do the above the assignment , Is the c copied as first row of p ? or c is copied as first column of p ?

也不是,该代码将 c 的第一个元素复制到 p 的第一个元素。相当于

p[0][0] = c[0];

关于c pointer assignment to pointer to pointer 是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7543547/

相关文章:

c - printf %s 段错误 - 为什么?

c - 海湾合作委员会错误 : two or more data types in declaration specifiers

C/C++ 宏求值顺序

c - MSP430 随机复位 'Security Violation (BOR)'

c - 函数内的静态变量

c++ - 使用结构和指针的多项式乘法

c++ - 如何将指向类方法的指针传递给 boost 线程

c++ - "pointer being freed was not allocated"

c - 在 C 中初始化指向结构的指针数组

c - 为什么我的 string_split 实现不起作用?