473,789 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the position of pointers

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?
Sep 11 '08
69 3219
On Sep 14, 10:35*pm, sh.vi...@gmail. com wrote:
I think it's the puzzle format that is the problem. I am an experienced
C programmer with absolutely no uncertainty about what pointers are, how
to use them, and why they are useful.

*may be language was not as good, i have already accepted that.
But I found the wording of that
puzzle so obscure that it took me 20-30 seconds to figure out what he
was driving at.

I will try to be better in futrue. In fact i tried to improve the
wording of
problem also in one of my earlier posts.
I think that someone who's still in the position to ask
"what are pointers good for?" is extremely unlikely to figure it out.
Code which solves that puzzle would have been better provided as an
example, than asked for as a solution.

in the original post, person has mentioned that "I found that all the
code
I wrote in C contains little pointers, obviously I avoid using them *"

so i assumed that he has at least used pointers in past and he will be
able to
realize the importance in the attempt to find the solution for this
problem.
prototype, you could then pose a puzzle which asks for a more
complicated answer that is based on the same concept.

yea that can also be a good approach too. I ll take a note of it.
at the end of all this discussion i hope the person, who needs to
be benefited, one who posted the query originally, is getting
benefited.

thnx all for your valuable inputs
--
vIpIn
Today I tried pointers again. It's more easier than what I've thought
before, and powerful!
Too glad to realize this:pointers makes my eyes brighten, really.

BTW: I've to admit that usernet is a strange place, first I want to
know your opinions about pointers, but now all of you are discussing
programing format or anything like that. That's really strange.
Sep 15 '08 #41
Yee.Chuang said:

<snip>
Today I tried pointers again. It's more easier than what I've thought
before, and powerful!
Too glad to realize this:pointers makes my eyes brighten, really.
They are easier than they at first seem. The most difficult thing to grasp
about pointers (and it /is/ difficult to grasp this) is that they are
really quite simple.
BTW: I've to admit that usernet is a strange place, first I want to
know your opinions about pointers, but now all of you are discussing
programing format or anything like that. That's really strange.
There is a party game called "Chinese Whispers", in which the first player
quietly and secretly reads a written phrase, and then whispers the phrase
into the ear of the next player, who whispers what he hears into the ear
of the third player, and so on. The last player says out loud what he
heard whispered into his ear, and it is compared with the written phrase.
It is often hilariously different.

What happens in Usenet threads is very similar, except that the
"corruption " comes not from slight mis-hearing but either from slight
misunderstandin g or a desire on the part of one or more contributors to
focus on a side issue that arose during discussion of the principal topic
of the thread. This isn't necessarily undesirable, and some quite
fascinating discussions can be started in this way. Due to the threaded
nature of the medium, this can happen in parallel with discussions on the
original topic, so it's not as if anything is lost - but it can seem a
little confusing at first.

In this case, someone posed a "puzzle" which was presumably intended to
help the solver to understand pointers a little better (and was thus
topical), but it merely prompted a discussion on whether this "puzzle"
idea was a good way to explain pointers. If you ignore the articles
involved in the "topic drift" and look only at the first article (the
"OP") and the last one to which you replied, you get a similar effect to
that of the "Chinese Whispers" game.

Bottom line: ignore the topic drift if you like, practise with pointers,
observe your implementation' s diagnostic messages, and ask when you don't
understand and your textbook seems to be of little or no help. In this
way, you should soon be in a position to use pointers in very creative and
powerful ways.

--
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
Sep 15 '08 #42
On Sep 15, 5:10*pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
Yee.Chuang said:
BTW: I've to admit that usernet is a strange place, first I want to
know your opinions about pointers, but now all of you are discussing
programing format or anything like that. That's really strange.

There is a party game called "Chinese Whispers", in which the first player
quietly and secretly reads a written phrase, and then whispers the phrase
into the ear of the next player, who whispers what he hears into the ear
of the third player, and so on. The last player says out loud what he
heard whispered into his ear, and it is compared with the written phrase.
It is often hilariously different.

What happens in Usenet threads is very similar, except that the
"corruption " comes not from slight mis-hearing but either from slight
misunderstandin g or a desire on the part of one or more contributors to
focus on a side issue that arose during discussion of the principal topic
of the thread. This isn't necessarily undesirable, and some quite
fascinating discussions can be started in this way. Due to the threaded
nature of the medium, this can happen in parallel with discussions on the
original topic, so it's not as if anything is lost - but it can seem a
little confusing at first.

In this case, someone posed a "puzzle" which was presumably intended to
help the solver to understand pointers a little better (and was thus
topical), but it merely prompted a discussion on whether this "puzzle"
idea was a good way to explain pointers. If you ignore the articles
involved in the "topic drift" and look only at the first article (the
"OP") and the last one to which you replied, you get a similar effect to
that of the "Chinese Whispers" game.

Bottom line: ignore the topic drift if you like, practise with pointers,
observe your implementation' s diagnostic messages, and ask when you don't
understand and your textbook seems to be of little or no help. In this
way, you should soon be in a position to use pointers in very creative and
powerful ways.

--
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
Thanks, Richard. Nice explaining, I Googled wikipedia to see how they
explain Usenet, yours is more interesting.
It seems that you treat Usenet as a game more than anything else, it's
really fun to know that it has a name called "Chinese Whispers". I
know many Chinese, they seldom play such kind of game. Now the most
popular one is "The Game of Killing" or "The Moment of Truth".
Anyway, Usenet is more than a game.
Sep 15 '08 #43
Yee.Chuang said:

<snip>
Thanks, Richard. Nice explaining, I Googled wikipedia to see how they
explain Usenet, yours is more interesting.
It seems that you treat Usenet as a game more than anything else,
No, I treat it as a way of learning and teaching. Fun, yes. Game, no.
it's
really fun to know that it has a name called "Chinese Whispers".
It doesn't. That was merely an analogy.
Anyway, Usenet is more than a game.
Strange but true.

--
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
Sep 15 '08 #44
REH
On Sep 11, 10:21*am, Stephen Sprunk <step...@sprunk .orgwrote:
That's pretty much what happened with me; I came from a Pascal
background where I had used pointers once or twice in several years, and
before that BASIC, which didn't even have the concept at all.
Sure it did/does. Look up "VARPTR."

REH
Sep 15 '08 #45
sh******@gmail. com wrote, On 14/09/08 02:40:

Please leave in the attribution lines. The bit that says who wrote what
like the above.
>> printf("\n Value of a is %d",a);
You have a call to printf. Where's the required #include <stdio.h>?

I don't know where this bizarre habit of putting the "\n" at the
beginning of a line rather than at the end came from. This prints an
unnecessary blank line, and fails to properly terminate the output
line.

Printing a blank line in beginning might be personal preference too,
but i certainly would like to know
what causes failure to properly terminate the output line.
<snip>

Not having a linefeed at the end of the last line output by the program
is (on some systems) failing to properly terminate the output. Two
common results of doing this are having the prompt appear on the end of
the line, e.g. seeing as the output:

Value of a is 20markg@brenda $

Or the last line of output being overwritten so the user does not see it.
--
Flash Gordon
Sep 15 '08 #46
"Yee.Chuang " <mc*******@gmai l.comwrote:
On Sep 12, 11:45=A0pm, Richard<rgr...@ gmail.comwrote:
CBFalconer <cbfalco...@yah oo.comwrites:
If C pointers are bothering you, you might consider first learning
Pascal and handling pointers therein. =A0Then returning to C would
mean abandoning the safety and adding new capabilities.
That is atrocious advice. And would certainly lead to expectations not
met by C.

Anyway outside of c.l.c pointers are easily taught. They are an address
where some data is. You can de-reference that address to get the data
there. You can advance the pointer to point to different addresses.

Trivial stuff when you do not try to be too clever and blind the poor
nOOB with ridiculous nonsense not applicable to their system at too
early a stage.

Hey, Richard, it's not so serious about that so called "atrocious
advice". I came here for your advise. Thanks for all of your
instructions, now I know more about points than I used to do, that's
great and fun.
There was no malice in their discussions.
I think you'll find that there _is_ malice in Richard NoSurname's
discussions. For what it's worth, in this case, he's talking complete
nonsense, and Chuck Falconer is correct (with the proviso that you want
_real_ Pascal, not Extended Pascal let alone Turbo Pascal, and that
something like Modula may be even better depending on circumstances.)

Richard
Sep 19 '08 #47
Richard wrote:
CBFalconer <cb********@yah oo.comwrites:
>Richard wrote:
>>CBFalconer <cb********@yah oo.comwrites:
... snip ...
>>>
If C pointers are bothering you, you might consider first
learning Pascal and handling pointers therein. Then returning
to C would mean abandoning the safety and adding new
capabilities .

That is atrocious advice. And would certainly lead to
expectation s not met by C.

Except that it duplicates my experience of long long ago, and I
have no problems with C pointers.

Of long long ago.

I have experience of new C programmers and have never, ever had a
problem explaining them pointers and de referencing pointers. I
tend to use a debugger a block of memory. Easy.

They do not need to learn a dead language like Pascal to
understand pointers.
Except that Pascal is not a dead language. It is less popular than
C, a better language for most purposes, and a much safer language.
It is even intrinsically more portable than C.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
Sep 19 '08 #48
CBFalconer <cb********@yah oo.comwrites:
[...]
Except that Pascal is not a dead language. It is less popular than
C, a better language for most purposes, and a much safer language.
I won't argue any of those points; they're either correct or matters
of personal opinion. But ...
It is even intrinsically more portable than C.
What exactly does "intrinsica lly more portable" mean?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 19 '08 #49
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
"Yee.Chuang " <mc*******@gmai l.comwrote:
>On Sep 12, 11:45=A0pm, Richard<rgr...@ gmail.comwrote:
CBFalconer <cbfalco...@yah oo.comwrites:
If C pointers are bothering you, you might consider first learning
Pascal and handling pointers therein. =A0Then returning to C would
mean abandoning the safety and adding new capabilities.

That is atrocious advice. And would certainly lead to expectations not
met by C.

Anyway outside of c.l.c pointers are easily taught. They are an address
where some data is. You can de-reference that address to get the data
there. You can advance the pointer to point to different addresses.

Trivial stuff when you do not try to be too clever and blind the poor
nOOB with ridiculous nonsense not applicable to their system at too
early a stage.

Hey, Richard, it's not so serious about that so called "atrocious
advice". I came here for your advise. Thanks for all of your
instructions , now I know more about points than I used to do, that's
great and fun.
There was no malice in their discussions.

I think you'll find that there _is_ malice in Richard NoSurname's
discussions. For what it's worth, in this case, he's talking complete
nonsense, and Chuck Falconer is correct (with the proviso that you
want
Incorrect. I think Falconers advice was atrocious. However, having seen
some people explain pointers I can see why some might even want to move
to Pascal and ignore C altogether.

You do not recommend an entirely different language to someone to learn
something as core and basic is pointer usage. The basics ARE simple and
any teacher worth his salt can get it across with a debugger and an OHP
in 2 or 3 minutes. THEN you can move into the platform independence etc.

_real_ Pascal, not Extended Pascal let alone Turbo Pascal, and that
something like Modula may be even better depending on circumstances.)

Richard
--
Sep 19 '08 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

669
26234
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
12
4215
by: slartybartfast | last post by:
I'm new(ish) to css, comfortable using tables, but trying real hard to move away. Please see http://84.9.125.31/developer/css_test/test5.html NB This issue is with IE & Opera - I've tried IE 6&7 and both have the same result. It works fine in FF. Thanks to Petr Stanicek for the original example. As you can see the table is 800px wide in the middle column and it's vertical position is affected by the amount of text in the left or right...
89
5774
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the right thing to use for every var that holds the number of or size in bytes of things. * size_t should only be used when dealing with library functions.
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6761
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.