C常见问题6.12 [英] C FAQs 6.12
问题描述
常见问题6.12 http://c-faq.com/aryptr/aryvsadr .html :
FAQ 6.12 http://c-faq.com/aryptr/aryvsadr.html :
int a [10];
int a[10];
对a的引用具有类型指向int的指针,并且& a是指向
10个整数的数组的指针。
a reference to "a" has type "pointer to int", and &a is "pointer to
array of 10 ints".
并且它没有提供任何关于如何获得指向整个数组的指针的代码
以及有什么意义这样的指针?
-
http ://lispmachine.wordpress.com/
当您通过电子邮件回复我时,请删除大写V。
and it does not give any code on how to get "a pointer to the whole array"
and what is the significance of such a pointer ?
--
http://lispmachine.wordpress.com/
Please remove capital ''V''s when you reply to me via e-mail.
推荐答案
2008年4月9日星期三14:28:44 +0500,arnuld写道:
On Wed, 09 Apr 2008 14:28:44 +0500, arnuld wrote:
并且它没有给出关于如何获得指向整个数组的指针的任何代码
这样的指针有什么意义?
and it does not give any code on how to get "a pointer to the whole array"
and what is the significance of such a pointer ?
我在这里得到了一些答案: http://c-faq.com/aryptr/ptrtoarray.html
但它会告诉我为什么要使用指向数组的指针 ?
- http://lispmachine.wordpress。 com /
当您通过电子邮件回复我时,请删除大写''V'。
I got some answers here: http://c-faq.com/aryptr/ptrtoarray.html
but it doe snot tell why should I use "pointer to arrays" ?
-- http://lispmachine.wordpress.com/
Please remove capital ''V''s when you reply to me via e-mail.
2008年4月9日星期三10:34:10 +0100,arnuld< ar ***** @ ippiVmail.comwrote:
On Wed, 09 Apr 2008 10:34:10 +0100, arnuld <ar*****@ippiVmail.comwrote:
我在这里得到了一些答案: http://c-faq.com/aryptr/ ptrtoarray.html
但它会告诉我为什么要使用指向数组的指针 ?
I got some answers here: http://c-faq.com/aryptr/ptrtoarray.html
but it doe snot tell why should I use "pointer to arrays" ?
当你想要遍历数组阵列时它可能很有用。
-
Martin
It may be useful when you want to walk through arrays of arrays.
--
Martin
arnuld写道:
arnuld wrote:
> ; 2008年4月9日星期三14:28:44 +0500,arnuld写道:
>On Wed, 09 Apr 2008 14:28:44 +0500, arnuld wrote:
>并且它没有提供任何代码如何获取指向整个数组的指针
这样的指针有什么意义?
>and it does not give any code on how to get "a pointer to the whole array"
and what is the significance of such a pointer ?
我在这里得到了一些答案: http://c-faq.com/aryptr/ptrtoarray.html
但它会告诉我为什么要使用指向数组的指针 ?
I got some answers here: http://c-faq.com/aryptr/ptrtoarray.html
but it doe snot tell why should I use "pointer to arrays" ?
您引用的链接的第一句话是:
通常,您不想这样做。当人们随便说一个指向
数组的指针时,它们通常意味着指向其第一个元素的指针。
我从未见过使用指针到数组。我不能告诉你任何理由为什么
你应该使用它们。他们可能是为了完整而存在。
菲利普
The first sentences of the link you quote are:
"Usually, you don''t want to. When people speak casually of a pointer to
an array, they usually mean a pointer to its first element."
I''ve never seen a pointer-to-array used. I can''t tell you any reason why
you should use them. They presumably exist for completeness.
Philip
这篇关于C常见问题6.12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!