473,587 Members | 2,477 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 3163
vi******@gmail. com writes:
On Sep 12, 12:20 pm, "Yee.Chuang " <mcdrag...@gmai l.comwrote:
>On Sep 12, 5:03 pm, Nick Keighley <nick_keighley_ nos...@hotmail. com>
wrote:
On 11 Sep, 22:28, CBFalconer <cbfalco...@yah oo.comwrote:
yes I moved from pascal to C and didn't find pointers a problem.
They seemed very like pascal pointers. Though I thought the sysntax
was *very* strange!
On the other hand I'd programmed in Coral, Assmebler and had
brief exposure to BCPL. So pointers seemed quite normal!

Something I forgot to tell: C is the first language I've learned,
after that I understand the basic skills of programming. Most of the
time I just use software like SAS, Matlab and R to solve problems.
Yes, I don't write any software, I just use them.
If learning pointers can help me with programing thoughts or improve
my program skills, I'm glad to do so.

Pointers are not a unique concept in C.
A pointer points to something. You can access that something via the
pointer.
That's all there is to it, as a generic concept.

Now, if you want to learn C pointers, first you'd have to understand
C's type system.
Given that p is char [4][2], you should immediately be able to tell
which type *p is, p[0][0], &p[0].
(answer: char [2], char, char (*)[2])
"p is char[4][2]"? I know pointers and I dont understand your example or
what you are trying to say.
Sep 12 '08 #11

<vi******@gmail .comwrote in message
news:5f******** *************** ***********@2g2 000hsn.googlegr oups.com...
On Sep 12, 12:20 pm, "Yee.Chuang " <mcdrag...@gmai l.comwrote:
>Something I forgot to tell: C is the first language I've learned,
after that I understand the basic skills of programming. Most of the
time I just use software like SAS, Matlab and R to solve problems.
Yes, I don't write any software, I just use them.
If learning pointers can help me with programing thoughts or improve
my program skills, I'm glad to do so.

Pointers are not a unique concept in C.
A pointer points to something. You can access that something via the
pointer.
That's all there is to it, as a generic concept.
Not quite. Those other languages use pointers behind the scenes, they
already have the 'something'.

C needs pointers just to implement those 'something's in the first place, or
to push them around. They're not an optional extra, not for dealing with
dynamic or flexible data.
Now, if you want to learn C pointers, first you'd have to understand
C's type system.
Given that p is char [4][2], you should immediately be able to tell
which type *p is, p[0][0], &p[0].
(answer: char [2], char, char (*)[2])
I wouldn't frighten off the OP with this stuff. I don't understand half of
it either.

--
Bartc

Sep 12 '08 #12
On Thu, 11 Sep 2008 12:41:13 +0000, Richard Heathfield
<rj*@see.sig.in validwrote:
>Yee.Chuang said:
>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!
Maybe pointers were mysterious to him. Or he felt them too dangerous
for a beginner, which we hear often. But we learn best by making
mistakes and then correcting them. Taking risks is the best part of
living.
>it makes me afraid of it.
Overcoming your fears is glorious!
>
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.

Sep 12 '08 #13
"Yee.Chuang " wrote:
Nick Keighley <nick_keighley_ nos...@hotmail. comwrote:
>CBFalconer <cbfalco...@yah oo.comwrote:
>>Stephen Sprunk wrote:
Yee.Chuang wrote:

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.

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.

Then you weren't using Pascal thoroughly. The prime uses of
pointers are very similar between Pascal and C, but Pascal doesn't
allow the loose generic conversion of VAR parameters to pointers,
and similar things for arrays, etc. This allows Pascal to check
for most common errors, unlike C.

yes I moved from pascal to C and didn't find pointers a problem.
They seemed very like pascal pointers. Though I thought the sysntax
was *very* strange!

On the other hand I'd programmed in Coral, Assmebler and had
brief exposure to BCPL. So pointers seemed quite normal!

Something I forgot to tell: C is the first language I've learned,
after that I understand the basic skills of programming. Most of the
time I just use software like SAS, Matlab and R to solve problems.
Yes, I don't write any software, I just use them.
If learning pointers can help me with programing thoughts or improve
my program skills, I'm glad to do so.
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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
Sep 12 '08 #14
CBFalconer <cb********@yah oo.comwrites:
"Yee.Chuang " wrote:
>Nick Keighley <nick_keighley_ nos...@hotmail. comwrote:
>>CBFalconer <cbfalco...@yah oo.comwrote:
Stephen Sprunk wrote:
Yee.Chuan g wrote:
>
>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
>finishin g C program class, I found that all the code I wrote in
>C contains little pointers, obviously I avoid using them.
>
That's pretty much what happened with me; I came from a Pascal
backgroun d where I had used pointers once or twice in several
years, and before that BASIC, which didn't even have the concept
at all.

Then you weren't using Pascal thoroughly. The prime uses of
pointers are very similar between Pascal and C, but Pascal doesn't
allow the loose generic conversion of VAR parameters to pointers,
and similar things for arrays, etc. This allows Pascal to check
for most common errors, unlike C.

yes I moved from pascal to C and didn't find pointers a problem.
They seemed very like pascal pointers. Though I thought the sysntax
was *very* strange!

On the other hand I'd programmed in Coral, Assmebler and had
brief exposure to BCPL. So pointers seemed quite normal!

Something I forgot to tell: C is the first language I've learned,
after that I understand the basic skills of programming. Most of the
time I just use software like SAS, Matlab and R to solve problems.
Yes, I don't write any software, I just use them.
If learning pointers can help me with programing thoughts or improve
my program skills, I'm glad to do so.

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 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.
Sep 12 '08 #15
On Sep 12, 11:45*pm, Richard<rgr...@ gmail.comwrote:
CBFalconer <cbfalco...@yah oo.comwrites:
"Yee.Chuang " wrote:
Nick Keighley <nick_keighley_ nos...@hotmail. comwrote:
CBFalconer <cbfalco...@yah oo.comwrote:
Stephen Sprunk wrote:
Yee.Chuang wrote:
>>>>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.
>>>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.
>>Then you weren't using Pascal thoroughly. *The prime uses of
pointers are very similar between Pascal and C, but Pascal doesn't
allow the loose generic conversion of VAR parameters to pointers,
and similar things for arrays, etc. *This allows Pascal to check
for most common errors, unlike C.
>yes I moved from pascal to C and didn't find pointers a problem.
They seemed very like pascal pointers. Though I thought the sysntax
was *very* strange!
>On the other hand I'd programmed in Coral, Assmebler and had
brief exposure to BCPL. So pointers seemed quite normal!
Something I forgot to tell: C is the first language I've learned,
after that I understand the basic skills of programming. Most of the
time I just use software like SAS, Matlab and R to solve problems.
Yes, I don't write any software, I just use them.
If learning pointers can help me with programing thoughts or improve
my program skills, I'm glad to do so.
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 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.
Sep 13 '08 #16
"Yee.Chuang " <mc*******@gmai l.comwrites:
On Sep 12, 11:45*pm, Richard<rgr...@ gmail.comwrote:
>CBFalconer <cbfalco...@yah oo.comwrites:
"Yee.Chuang " wrote:
Nick Keighley <nick_keighley_ nos...@hotmail. comwrote:
CBFalconer <cbfalco...@yah oo.comwrote:
Stephen Sprunk wrote:
Yee.Chuan g wrote:
>>>>>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
>finishin g C program class, I found that all the code I wrote in
>C contains little pointers, obviously I avoid using them.
>>>>That's pretty much what happened with me; I came from a Pascal
backgroun d where I had used pointers once or twice in several
years, and before that BASIC, which didn't even have the concept
at all.
>>>Then you weren't using Pascal thoroughly. *The prime uses of
pointers are very similar between Pascal and C, but Pascal doesn't
allow the loose generic conversion of VAR parameters to pointers,
and similar things for arrays, etc. *This allows Pascal to check
for most common errors, unlike C.
>>yes I moved from pascal to C and didn't find pointers a problem.
They seemed very like pascal pointers. Though I thought the sysntax
was *very* strange!
>>On the other hand I'd programmed in Coral, Assmebler and had
brief exposure to BCPL. So pointers seemed quite normal!
>Something I forgot to tell: C is the first language I've learned,
after that I understand the basic skills of programming. Most of the
time I just use software like SAS, Matlab and R to solve problems.
Yes, I don't write any software, I just use them.
If learning pointers can help me with programing thoughts or improve
my program skills, I'm glad to do so.
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 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 realise there was no malice. But it was a silly idea to tell someone
to learn an entire different language to teach what is, after all, a
relatively simple concept when approached in the correct
manner. Especially an effectively dead language such as Pascal which
Falconer seems to love.
Sep 13 '08 #17
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 expectations
not met by C.
Except that it duplicates my experience of long long ago, and I
have no problems with C pointers.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
Sep 13 '08 #18
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 expectations
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.

Sep 13 '08 #19
On Sep 11, 5:02 am, "Yee.Chuang " <mcdrag...@gmai l.comwrote:
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?

I personally had more issues with the math end of C than pointers
themselves. Yes, I had real issues with the concepts of logical
conjunction, disjunction, implication, and NAND. De Morgans law also
bit me. With that, I'm just going back to being a silent bystander on
this forum.
Sep 13 '08 #20

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

Similar topics

669
25771
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
4197
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
5679
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
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
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
8349
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
8221
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
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
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();...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
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.