Fun with Pointers (not the dogs)

One of the aspects of programming that took me a long time to understand was (memory) pointers. I grew up with BASIC, learned Pascal and C where I always used fixed length structures or types and never cared about memory allocation as it was way too confusing to me. In college, I majored in engineering and only took 1 computer science class, so most of my programming knowledge is self-taught, on the job training. It wasn’t until a few years out of college that how pointers worked really clicked. These days, with high level frameworks and languages such as Objective-C and Cocoa, I don’t use pointers all that often (I still have to deal with allocation and de-allocation of memory), but when I need to use them, they’re a piece of cake to use. I find that I only use them when shipping data across a wire, i.e. to/from a handheld device. Knowing how to use pointers, walk pointers, etc. makes complicated code very easy. I think that understanding how pointers work is essential to being able to write applications that aren’t self-contained, i.e. only run on a desktop machine. I wish I had learned about them earlier as I’m sure it would have made my life easier.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.