指向自身的指针 [英] a pointer that points to itself
问题描述
C中是否可以声明并初始化指向
本身的指针?为什么或为什么不呢?
Is it possible in C to declare and initialize a pointer that points to
itself? Why or why not?
推荐答案
dough写道:
dough wrote:
是在C中可以声明并初始化指向
本身的指针吗?为什么或为什么不呢?
Is it possible in C to declare and initialize a pointer that points to
itself? Why or why not?
当然可以,但它的用途是什么?
Sure, but of what use would it be?
在文章< 11 ********************** @ g44g2000cwa.googlegroups .com> ;,
tedu< tu @ zeitbombe。有机>写道:
In article <11**********************@g44g2000cwa.googlegroups .com>,
tedu <tu@zeitbombe.org> wrote:
dough写道:
在C中是否可以声明并初始化指向
本身的指针?为什么或为什么不呢?
Is it possible in C to declare and initialize a pointer that points to
itself? Why or why not?
当然,但它有什么用途?
Sure, but of what use would it be?
我怀疑''面团''的意思是在单一声明中使用它
将回答作业问题。
我有一个编译和执行的解决方案没有问题
我抛出的任何警告级别。它确实提高了一些微妙的语言
积分。
-
好的,只有流行语。两个音节,上衣。 - Laurie Anderson
I suspect that ''dough'' means "in a single statement". The use of it
would be to answer homework questions.
I have a solution that compiles and executes without problem with
any warning level I throw at it. It does raise some subtle language
points.
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
Walter Roberson写道:
Walter Roberson wrote:
tedu< tu@zeitbombe.org>写道:
tedu <tu@zeitbombe.org> wrote:
dough写道:
C是否可以声明并初始化指向自身的指针?为什么或为什么不呢?
Is it possible in C to declare and initialize a pointer that points
to itself? Why or why not?
当然,它的用途是什么?
Sure, but of what use would it be?
我怀疑''面团''的意思是在单一声明中使用它
将回答作业问题。
我有一个解决方案,编译和执行没有问题
我投掷的任何警告级别。
I suspect that ''dough'' means "in a single statement". The use of it
would be to answer homework questions.
I have a solution that compiles and executes without problem with
any warning level I throw at it.
我怀疑这样做很少,编译器编写者无法证明检测可疑代码所需的时间和代码是合理的。 />
确实提高了一些微妙的语言点。
I suspect it''s done so rarely that compiler writers can''t justify the
time and code needed to detect the questionable code.
It does raise some subtle language points.
包含1个元素的通用循环列表可能有一个指针
指向自己。如果你在谈论像......这样的表达式。
p =((演员)p) - >下一个;
.. ..之前已在csc讨论过这个问题。
-
彼得
A generic circular list containing 1 element may well have a pointer
that
points to itself. If you''re talking about expressions like...
p = ((cast) p)->next;
....then this has been discussed before in csc.
--
Peter
这篇关于指向自身的指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!