双指针 [英] double pointer
问题描述
如果我有:
int a = 100,b = 200,c = 300;
int * a [ ] = {& a,& b,& c};
比说:
int ** b等于to int * a []是正确的????
因此双指针与指针数组相同???
谢谢
Hi, if I have:
int a=100, b = 200, c = 300;
int *a[] = {&a, &b, &c};
than say that:
int **b is equal to int *a[] is correct????
thus a double pointer is the same of an array of pointers ???
Thanks
推荐答案
xdevel写道:
xdevel wrote:
如果我有:
int a = 100,b = 200,c = 300;
int * a [] = {& a, & b,& c};
Hi, if I have:
int a=100, b = 200, c = 300;
int *a[] = {&a, &b, &c};
我不认为这会编译,你已经定义了a两次。发布一个
完成
示例并在发布之前编译它。
I don''t think this will compile, you''ve defined "a" twice. Post a
complete
example and compile it before you post.
比说:
int ** b等于int * a []是正确的????
than say that:
int **b is equal to int *a[] is correct????
现在你已经重新定义了b。
now you''ve redfined "b".
因此双指针是相同的指针数组???
thus a double pointer is the same of an array of pointers ???
no。但我不明白你想做什么。发布实际代码。
-
Nick Keighley
no. But I don''t understand what you are trying to do. Post real code.
--
Nick Keighley
xdevel说:
xdevel said:
如果我有:
int a = 100,b = 200,c = 300;
>
int * a [] = {& a,& b,& c};
Hi, if I have:
int a=100, b = 200, c = 300;
int *a[] = {&a, &b, &c};
姓名冲突。
Name conflict.
比说:
int ** b等于int * a []是正确的????
than say that:
int **b is equal to int *a[] is correct????
编号int ** b与int b = 200冲突。
不,int **不是与int [3]类型相同。
No. int **b conflicts with int b = 200.
And no, int ** is not the same type as int [3].
因此双指针与指针数组相同???
thus a double pointer is the same of an array of pointers ???
不,双指针是指向双倍的指针:
double d = 3.14;
double * p =& d;
int **是指向int的指针。所以它指向
(如果指向任何合理的位置)是指向int的指针。
int i = 42; / * int * /
int * p =& i; / * p指向i * /
int ** pp =& p; / * pp指向p * /
-
Richard Heathfield
Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk
电子邮件:rjh在上面的域名(但显然放弃了www)
No, a double pointer is a pointer to a double:
double d = 3.14;
double *p = &d;
int ** is a pointer to a pointer to an int. So the thing that it points to
(if it is pointing anywhere sensible) is a pointer to int.
int i = 42; /* int */
int *p = &i; /* p points to i */
int **pp = &p; /* pp points to p */
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
" xdevel" < xd ******** @ yahoo.comwrites:
"xdevel" <xd********@yahoo.comwrites:
如果我有:
int a = 100,b = 200,c = 300;
int * a [] = {& a,& b,& c};
比说:
int ** b等于int * a []是正确的????
因此双指针与指针数组相同???
Hi, if I have:
int a=100, b = 200, c = 300;
int *a[] = {&a, &b, &c};
than say that:
int **b is equal to int *a[] is correct????
thus a double pointer is the same of an array of pointers ???
编号数组不是指针。指针不是数组。
comp.lang.c常见问题解答位于< http://www.c-faq.com/>。阅读第6节,
阵列和指针。
-
Keith Thompson(The_Other_Keith) ks *** @ mib.org < http://www.ghoti.net/~kst>
圣地亚哥超级计算机中心< *< http://users.sdsc.edu/~kst>
我们必须做点什么。这是事情。因此,我们必须这样做。
No. Arrays are not pointers. Pointers are not arrays.
The comp.lang.c FAQ is at <http://www.c-faq.com/>. Read section 6,
"Arrays and Pointers".
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
这篇关于双指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!