是什么限定炭之间差的[5]和char(*一)[5]? [英] what is difference between defining char a[5] and char (*a)[5]?
本文介绍了是什么限定炭之间差的[5]和char(*一)[5]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想确认之间的差异*一[5](*一)[5] C语言编写。
I just want to make sure the difference between *a[5] and (*a)[5] in C language.
我知道一个* [5]是指阵列可以有五个元素,每个元素的指针。
因此,
I know that the *a[5] means the array a can have five elements and each element is pointer. so,
char *p = "ptr1";
char *p2 = "ptr2";
char *a[5] = { p , p2 };
这有一定道理。
但是,当我改变了 *一个[5]
到(*一)[5]
它不的工作。
But when I changed *a[5]
to (*a)[5]
it doesn't work.
char (*a)[5] = { p , p2};
这是什么(*一)[5]
意味着什么?
在此外,
有间 *一个[5]
和 A [5] []
和<$有什么区别C $ C>(*一)[5] 和 A [] [5]
?
推荐答案
一个很不错的网站存在的德codeS这样的原型:的http:// cdecl.org/
A great web site exist that decodes such prototypes: http://cdecl.org/
char *a[5] --> declare a as array 5 of pointer to char
char a[5][] --> declare a as array 5 of array of char
char (*a)[5] --> declare a as pointer to array 5 of char
char a[][5] --> declare a as array of array 5 of char
这篇关于是什么限定炭之间差的[5]和char(*一)[5]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文