New Direction
Well then. Ellen’s finished her GCSEs and is waiting for results to come through in a couple of days before jetting off to college: our home education journey is finally at an end. It’s been fun but...
View ArticleHow to Get Back on the Horse
It’s time for a concrete todo list. I covered the general subject areas in my New Direction post but this list will put some flesh on the bones with some actual objectives. As per David Allen’s GTD...
View ArticleWeb Dev Site
I’ve moved my web development site to a new location. It seems to be working fine but if you notice any problems don’t hesitate to call me out on my incompetence.
View ArticleMemory Electronics
This is just a stub for now but in order to avoid your inevitable disappointment have a lovely link. From a top level perspective you can think of each bit of computer memory as having the following...
View ArticlePointer Operators
Pointers, as you would expect given the not insignificant clue in the name, point to something. Although that’s not necessarily as obviously true as you might think. They point to the memory word at...
View ArticleReading Pointer Code
This is just a stub for now but in order to avoid your inevitable disappointment have a lovely link.
View ArticleNull Pointers
The null pointer in C is a bit of an odd beast. It’s a pointer that doesn’t point to anything. Specifically, it doesn’t point to an object in memory and it doesn’t point to a function either. Now, you...
View ArticlePointer Types
C is a statically typed language, meaning that we explicitly tell the compiler what type our objects are. For example, in Python, which is dynamically rather than statically typed, we’d write value =...
View ArticlePointers to Arrays
Arrays are contiguous blocks of memory holding multiple objects of the same type. These can be quite large and passing them into functions in the conventional, by value sense, can be quite inefficient...
View ArticlePointers To Structs
There’s just one little wrinkle you need to know about structs when it comes to pointers. If you have a pointer to a struct and you want to get access to one of its fields then there’s a shorthand:...
View ArticlePointers to Pointers
In addition to the familiar pointers to standard types like ints, floats, arrays and structs, we can also have pointers to pointers: int i = 1; int *ip = &i; int **pp = &ip;
View ArticleWhy Use Pointers?
The top-level answer to this is that pointers are sometimes the only way to express a computation and more often they simply lead to more compact and efficient code. As answers go, that’s not very...
View ArticleIntroduction to C Pointers
The key to understanding C, especially if you’re coming at it from an embedded software context, is to approach the language from the perspective of the hardware. Most discussions of pointers in C...
View ArticleReferential Semantics
This is going to be a bit abstract but it’s honestly really worth trying to get your head around if you want a good solid foundation in pointers and referential semantics in general. Let’s start with a...
View ArticleHow Many Threes Are There In The Universe?
The obvious answer is “quite a lot”. There’s the three on the front of my house, there are a couple more in my phone number and there’s one on the number plate of the car across the street from me...
View ArticleHow To Avoid Using Globals For Information Passing
If you’ve run into the classic noob C programmer’s problem of “Why won’t my function update my variable?” then you might have resorted to using a global variable instead of passing the variable into...
View ArticlePointers As Function Parameters
Suppose you’re writing a function to double a given number. You might naively assume that this would be a reasonable solution: If you run it you’ll find number remains unchanged. This is, you might be...
View ArticleWhy Does My Function Not Update My Variable?
C passes parameters by value – it makes local copy variables of parameters passed into functions. Passing in a pointer means you get a copy of the pointer but that copy is still pointing to the...
View ArticleAvoid Passing Large Chunks Of Data
Because of C’s pass by value semantics, passing data into functions using parameters requires pushing and popping that data onto and off the stack, byte by byte. Using return values to pass data out of...
View ArticleWhy Should I Not Use Pointers?
So if pointers are so great, why not only use pointers? For two reasons, both of which are consequences of the fact that pointers are a method of indirection. Indirection is, at heart, adding a step to...
View Article