Linked lists

Python has a rather handy list method. It allows you to add and remove items at will. How it actually does this is rather elaborate and you can read all about it over here. C doesn’t give you the same flexibility. When you create an array, it is of X size. That size cannot change as there is no guarantee that memory on either side of the existing array space is even free for you. For this reason there is a handy data structure called the linked list. ...

14 May 2015 · 13 min · 2613 words · Darren O'Connor

Structs in C

Back in March 2014 I wrote an app in Python that would log in and check various OSPF properties. When putting the data into a structure, I was limited both by knowledge and Python at the time. I ended up using a dictionary which worked rather well, but I was never 100% happy with it. Recently I’ve stumbled across structs in C, in which I can make pretty much any data structure I would like. ...

5 May 2015 · 7 min · 1295 words · Darren O'Connor

Visualising recursive functions

I’ve been doing a lot of coding practise, and recursive functions are one of those things that’s easier to visualise than think about. At it’s heart, a recursive function is one that calls itself in over and over again until a result is found. At first that doesn’t make sense so let’s look at an example. Factorial The factorial of a number is the product off all numbers from that number down to 1. Two examples follow: ...

20 April 2015 · 7 min · 1296 words · Darren O'Connor