473,769 Members | 1,711 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 #1
69 3207
On 2008-09-11 13:02:27 +0100, "Yee.Chuang " <mc*******@gmai l.comsaid:
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?
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

Sep 11 '08 #2
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.
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?
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
Sep 11 '08 #3
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!
it makes me afraid of it.
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
Sep 11 '08 #4
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.

What's funny is that, when I finally forced myself to learn, pointers
turned out to be a lot easier to deal with than I expected. There just
aren't many good books that teach it right, nor teachers who really
understand it well enough to explain it well to students.
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.
I have to agree with that.
So now I'm wondering: what's the exact position of pointers in C? Is
it really necessary to learn how it works again?
You really can't unlock the power that C offers without understanding
and using pointers. If you don't, you're really just writing Pascal
that looks like C.

S
Sep 11 '08 #5
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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
Sep 11 '08 #6
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.
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?
In general you need pointers to build dynamic data structures like
linked lists. In C you also need pointers to simulate call by reference.
August
Sep 11 '08 #7
On 11 Sep, 22:28, 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!
--
Nick Keighley

Unicode is an international standard character set that can be used
to write documents in almost any language you're likely to speak,
learn or encounter in your lifetime, barring alien abduction.
(XML in a Nutshell)
Sep 12 '08 #8
On Sep 12, 5:03*pm, Nick Keighley <nick_keighley_ nos...@hotmail. com>
wrote:
On 11 Sep, 22:28, 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!

--
Nick Keighley

Unicode is an international standard character set that can be used
to write documents in almost any language you're likely to speak,
learn or encounter in your lifetime, barring alien abduction.
* * * * * * *(XML in a Nutshell)
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.
Sep 12 '08 #9
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])

That's half the work. The other half is to read the semantics of
pointers.

HTH.
Sep 12 '08 #10

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

Similar topics

669
26191
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
4212
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
5763
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
9579
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
9415
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
10198
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
10032
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
9848
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
8860
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...
0
6661
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
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5432
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.