这是一个指向数组的指针开始的一个指针? [英] Is this a pointer to a pointer of the start of an array?
本文介绍了这是一个指向数组的指针开始的一个指针?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚帮助别人出一些code。他有这样的:
I've just been helping someone out with some code. He had this:
char dataArray[10];
然后想获得的指针数组的起始。而不是使用:
Then wanted to get a pointer to the start of the array. Rather than use:
&dataArray[0]
或只是
dataArray
他用
&dataArray
他有没有带指针的指针也结束了?我不知道是什么&放大器; dataArray中
会给他
推荐答案
-
&放大器; dataArray中[0]
的类型为的char *
。这是一个指向字符
。 -
dataArray中
的类型为的char [10]
-
&放大器; dataArray中
将类型字符(*)[10]
。这是一个指针到数组。
&dataArray[0]
is of typechar *
. That is a pointer tochar
.dataArray
is of typechar[10]
&dataArray
will be of typechar (*)[10]
. That is a pointer-to-array.
除此之外,在值的将是一样的。
Apart from that, the value will be same.
他们都不是的指针到指针的位置。他们只是在终场前不同的类型。
None of them is a pointer-to-pointer here. They are just pointer with different types.
注:由于数组腐烂的财产,的char [100]
将衰减到的char *
例如,当作为一个函数的一个agument通过。
Note: Because the array decaying property, char [100]
will decay to a char *
, for example, when passed as an agument of a function.
这篇关于这是一个指向数组的指针开始的一个指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文