Understanding C pointers: Part 0

“C/C++ Pointers are evil. Ditto direct control of memory via malloc, free, new and delete. Java, C# and other ’safe’ languages are the wave of the future, man!”

Even if you shouted a hearty, “Amen, brother!” after reading those sentences, the C/C++ languages can teach you something useful. Understanding how to directly control memory with “close to the metal” languages like C and C++ can make you smarter, which is a good goal even if you won’t admit to having used such old-school languages.

Of course that new knowledge may displace other knowledge you want to retain, like Mr. Belvedere episode plot lines or your wedding anniversary. You’ve been warned.

Over the next few posts I’m going to try to explain how C pointers work. I assume you’re at least a little familiar with a C-type imperative programming language – if you’ve ever seen Pascal, BASIC, Fortran, C# or Java you should be fine.

I’ve always heard pointers introduced to students as “a difficult thing, this is hard, you won’t understand it…” – which is baloney. It’s worse than just baloney, actually – it’s spoiled baloney (or bologna, I guess), because it not only tastes bad, but also makes you sick. It sets you up for failure. Telling someone that they can’t learn something, and then attempting to teach it to them is… well, I’ll just say it’s foolish and leave it at that.

Pointers are NOT difficult to understand when explained well – I hope that I’m able to explain C/C++ pointers in an easy to understand way – please let me know if anything doesn’t make sense!

Understanding C pointers: Part 1” is now available, check it out.

4 comments so far

  1. emardesign on

    I attend the next post impatiently!
    I’m afraid that my blog is only in italian.
    good bye,

    emar

  2. [...] enjoyed teaching it – maybe you could trade me some .NET lessons for some C lessons.  You check my post on pointers to get [...]

  3. [...] teaching it – maybe you could trade me some .NET lessons for some C lessons. You check my post on pointers to get started. :-) Tags: programming, software, software development, stack overflow, web [...]

  4. [...] I said in “Understanding C pointers: Part 0,” I’m going to try to explain how C pointers [...]


Leave a reply

You must be logged in to post a comment.