int *array[32] 是指向 32 个整数的数组的指针,还是指向 int 的 32 个指针的数组?有关系吗? [英] Is int *array[32] a pointer to an array of 32 ints, or an array of 32 pointers to int? Does it matter?
本文介绍了int *array[32] 是指向 32 个整数的数组的指针,还是指向 int 的 32 个指针的数组?有关系吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我写
int *columns[32];
我是否定义了一个包含 32 个指向 int
s 的指针的数组?
或者它是一个指向 32 个 int
的数组的指针?
am I defining an array with 32 pointers to int
s?
Or is it a pointer to an array of 32 int
s?
如何区分两者?有区别吗?
How do I differentiate between the two? Is there a difference?
推荐答案
如有疑问 - 问 cdecl
$> cdecl
Type `help' or `?' for help
cdecl> explain int *columns[32]
declare columns as array 32 of pointer to int
EDIT 针对评论:我在 Google 代码搜索.它需要 GNU readline 库.我认为在 Mac OS X 或 Windows 上编译它应该没有问题.
EDIT In response to comments: I found cdecl source on Google Code Search. It requires GNU readline library. I think it shouldn't be a problem to compile it on Mac OS X or Windows.
这篇关于int *array[32] 是指向 32 个整数的数组的指针,还是指向 int 的 32 个指针的数组?有关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文