【发布时间】:2020-07-29 00:59:18
【问题描述】:
根据我从堆栈溢出中找到的一些代码,我编写了以下代码:
char *split[NPTR] = { NULL }, **p = split;
我不太明白为什么第一个变量应该在一个具有NPTR 并分配了{NULL} 的字符数组中。和char *split[] = NULL 有什么不同吗?
另外,当我运行代码时,代码会吐出以下错误:
error: NPTR' undeclared (first use in this function)
note: each undeclared identifier is reported only once for each function it appears in
【问题讨论】:
-
看起来应该有一个
#define NPTR x,其中x是要定义的指针数。您可以链接您用作参考的 SO 帖子吗? -
感谢您的评论。我发现
#define NPTR 32 /* if you need a constant, #define one (or more) */包含在其中,所以我假设这个NPTR会有32 个可能的指针?链接在这里:stackoverflow.com/questions/61148561/…