c 指向字符串数组的指针数组

标签 c pointers

我的目标是创建一个指针数组,其中每个指针将指向一个字符串数组。例如 这种类型的字符串数组:

arr=["hello","my","name","is"];

以及这种类型的指针数组:

pointer[1]=&arr;

如何声明指针数组? 这就是能够创建的内容,但我不确定它是否正确 char * (*Line)[Lines(字典)];

我将非常高兴收到问题的可能解决方案

最佳答案

const char* arr[] = { "hello", "my", "name", "is" };
const char** pointer[] = { &arr };

关于c 指向字符串数组的指针数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20163082/

相关文章:

C++ 指向成员函数的指针

c - 驯服 malloc/free 野兽——提示与技巧

c - 对 xxx include 的 undefined reference 不起作用

c - 使用 C 进行试验 - 为什么我不能分配和使用 2GB 内存?

c++ - 为什么我可以将 void* 静态转换为 int* 而不能转换为 int*&?

c++ - Valgrind 报告内存泄漏,但我不明白它发生在哪里

c - 在 C 中如何将 X、Y 点转换为 Rho、Theta 以进行霍夫变换?

c++ - cstdio 流与 iostream 流?

c++ - 指向类的成员函数的指针

pointers - "cannot take the address of"和 "cannot call pointer method on"