Generic List in C

Introduction Lists (dynamic arrays) are yet another super useful data structure that C just doesn’t have. C arrays are great for when you can get away with a fixed size but not so fun if you need to dynamically expand because you don’t know quite how many elements you’ll need. You could use a series of reallocs and memmoves but that’s going to get old really fast. It’s also error prone and not obvious when growth is needed....

April 9, 2020 · John

Generic Hashtable in C

Introduction So, C doesn’t have a native hashtable object but that’s not a problem because we can use one one someone else wrote. Lack of a robust standard library is probably the biggest impoundments of working with C. It’s a real shame C doesn’t natively support hashtables because they are so versatile. You should keep this saying in mind, “when in doubt hash it out”. It works for programming and for life in general....

March 6, 2020 · John