3 ms·
> C is only cumbersome when you don't already have the data structures you want implemented, which is why there are usually many libraries for any one data stru
by StavrosK 10y ago
> C is only cumbersome when you don't already have the data structures you want implemented, which is why there are usually many libraries for any one data structure you want to represent, and operations on it.
I suspect this is the mistake I'm making, because 90% of my time is spent writing code to do data structure manipulation. I'll look around and try to find some libraries for things, but I'm usually constrained to the ecosystem of the particular flavor of C I write (for the Arduino, which is really C++, but still). I guess most general-purpose libraries will work there too, though.
> As for array bounds, it should work so long as you don't access out of bounds, and you can do that by making sure you know what you're accessing.
No, they do work, it just takes me ages to find the correct thing to tell the compiler so it understands what I want to do. Don't get me started on the ten types of string, though :(
- yoklov 10y agoIf you're writing C code, the right way to think about data structures in a lot of cases is that they're an optimization. You can implement a map using an array of struct { key, value }, and O(n) search. If you keep it sorted, that becomes O(n log n). A hash table is a further optimization. Most of the time you don't need these.