指针的位置是什么? [英] What's the position of pointers

查看:87
本文介绍了指针的位置是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我开始学习C时,我的老师告诉我,指针是C中最难的部分,它让我害怕它。完成C

程序类之后,我发现我在C中编写的所有代码都包含很少的

指针,显然我避免使用它们。

几天前,当我读一本关于编程的书时,我被告知

指针是C语言的本质,如果我不能使用它

好吧,我是一个糟糕的程序员,这是一个很大的震撼。

所以现在我想知道:C中指针的确切位置是什么?

是否真的有必要了解它是如何再次运作的?

When I began to learn C, My teacher told me that pointer is the most
difficult part of C, it makes me afraid of it. After finishing C
program class, I found that all the code I wrote in C contains little
pointers, obviously I avoid using them.
A few days ago when I was reading a book about programming, I was told
that pointers are the very essence of C language, if I couldn''t use it
well, I''m a bad programmer, it''s a big shock.
So now I''m wondering: what''s the exact position of pointers in C? Is
it really necessary to learn how it works again?

推荐答案

On 2008-09-11 13:02: 27 + 0100,Yee.Chuang < mc ******* @ gmail.comsaid:
On 2008-09-11 13:02:27 +0100, "Yee.Chuang" <mc*******@gmail.comsaid:

当我开始学习C时,我的老师告诉我指针是最

C的困难部分,它让我害怕它。完成C

程序类之后,我发现我在C中编写的所有代码都包含很少的

指针,显然我避免使用它们。

几天前,当我读一本关于编程的书时,我被告知

指针是C语言的本质,如果我不能使用它

好吧,我是一个糟糕的程序员,这是一个很大的震撼。

所以现在我想知道:C中指针的确切位置是什么?

真的有必要再学习它是如何工作的吗?
When I began to learn C, My teacher told me that pointer is the most
difficult part of C, it makes me afraid of it. After finishing C
program class, I found that all the code I wrote in C contains little
pointers, obviously I avoid using them.
A few days ago when I was reading a book about programming, I was told
that pointers are the very essence of C language, if I couldn''t use it
well, I''m a bad programmer, it''s a big shock.
So now I''m wondering: what''s the exact position of pointers in C? Is
it really necessary to learn how it works again?



必备。


标准库大量使用它们,大多数API也是如此。另外

将数组传递给函数的东西会衰减成指针等等

等等。在函数之间传递结构,动态内存

分配。这个清单是无穷无尽的。


如果你不使用C中的指针,为什么不使用Python这样的语言

呢?

-

我不赞成你说的话,但我会为你的权利辩护

说出来。 - 伏尔泰

Essential.

The standard library makes heavy use of them, as do most APIs. Also
things like passing arrays to functions decay into a pointer and so on
and so forth. Passing structs between functions, dynamic memory
allocation. The list is endless.

If you don''t use pointers in C why don''t you use a language like Python
instead?
--
"I disapprove of what you say, but I''ll defend to the death your right
to say it." - Voltaire


Yee.Chuang写道:
Yee.Chuang wrote:

当我开始学习C时,我的老师告诉我,指针是C最难的部分,这让我很害怕。完成C

程序类之后,我发现我在C中编写的所有代码都包含很少的

指针,显然我避免使用它们。

几天前,当我读一本关于编程的书时,我被告知

指针是C语言的本质,如果我不能使用它

好吧,我是一个糟糕的程序员,这是一个很大的震撼。

所以现在我想知道:C中指针的确切位置是什么?

真的有必要再学习它是如何工作的吗?
When I began to learn C, My teacher told me that pointer is the most
difficult part of C, it makes me afraid of it. After finishing C
program class, I found that all the code I wrote in C contains little
pointers, obviously I avoid using them.
A few days ago when I was reading a book about programming, I was told
that pointers are the very essence of C language, if I couldn''t use it
well, I''m a bad programmer, it''s a big shock.
So now I''m wondering: what''s the exact position of pointers in C? Is
it really necessary to learn how it works again?



学习C的一半是学习编写函数。

学习C的一半是学习使用指针。

学习C的另一半,正在学习关于C的其他一切。


那加起​​来对吗? ;)


大多数标准库函数,

将指针作为参数,

因此学习指针有一定的重要性好吧。


我主要在每个给定的机会使用指针。


您最有可能使用子表达式

正在转换为指针类型,

而你没有意识到它,

每当你编写你认为避免使用指针的代码时。

-

pete

Half of learning C, is learning to write functions.
Half of learning C, is learning to use pointers.
The other Half of learning C, is learning everything else about C.

Does that add up right? ;)

Most of the standard library functions,
take pointers as arguments,
so there is some importance to learning pointers well.

I mostly use pointers at every given opportunity.

You are most likely using subexpressions
which are being converted to pointer types,
without you being aware of it,
whenever you write code that you think avoids the use of pointers.

--
pete


Yee.Chuang说:
Yee.Chuang said:

当我开始学习C时,我的老师告诉我,指针是C的最难的部分,
When I began to learn C, My teacher told me that pointer is the most
difficult part of C,



他可能告诉我你不是因为他们很难学习(他们不是!),而是因为他们很难教,所以很难教导他们!

He probably told you that not because they''re hard to learn (they aren''t!),
but because they''re hard to teach!


它让我害怕它。
it makes me afraid of it.



是的,你并不孤单。但是值得克服这种恐惧,因为

指针是C语言的本质。一旦你得到他们,

你的眼睛会亮起来,还有POWER!这个词。会弹出你的脑袋,

并且不会阻止你。


-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

Yes, you''re not alone. But it''s worth overcoming that fear, because
pointers are the very essence of the C language. And once you "get" them,
your eyes will light up, and the word "POWER!" will pop into your head,
and there''ll be no stopping you.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


这篇关于指针的位置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆