tags:

views:

174

answers:

6

I have committed to learning C now, I'm good with Python/PHP/Bash but I've decided I'm limited by not being fluent in C. However I cannot imagine working in a language without lists and hashes, maybe I'm just jumping a gun, but surely there are 'standard' collection libraries. I do not see any in the GNU standard lib though, any suggestions?

+10  A: 

C is lower level than you're used to. There are no standard collections in C outside of the array.

tloach
Ya, OP will be surprised there isn't even function overloading and you can't declare variables in the middle of a function
Pyrolistical
@Pyrolistical C99 allows for variable declarations in the middle of a function
amrox
I wasn't clear and I feel bad about that, I thought putting the quotes around 'standard' made it clear that I was asking for a community standard.
flaxeater
A: 

There aren't really standard collections in C. Being a very low-level language (compared to C++ and more "modern" languages)

C++ adds these via the Standard Template Library. Most of the "collections" such as hashing and lists are based on object oriented or generic programming techniques unavailable (other than via convention) in C.

Reed Copsey
+8  A: 

There is no "standard" set of collection classes for C. Many people simply roll their own as needed.

But of course, there are some libraries filling this gap. For example, glib offers linked lists, hashtables and various kinds of trees.

Thomas
yes this is really what I was asking. I saw that there was no 'standard' but I know there's a toolkit that people out there primarily use. This is probably it. :) Thanks
flaxeater
+4  A: 

Maybe you should try looking into glib. While it's not a standard in the same sense as STL for C++ it's a proven library and is used in a lot of applications.

http://library.gnome.org/devel/glib/2.22/

Frank Hale
A: 

There are no "standard" (as in part of the ISO C standard) container libraries, at least not as of C99. I've seen several third-party attempts; all had some degree of lossage or another.

C has a very primitive and meager toolkit; I've compared programming in C to building a house with nothing but a handsaw and a claw hammer.

John Bode
+1  A: 

There is no standard, but there is a superb alternative that is far simpler than glib: Dave Hanson's C Interfaces and Implementations. It includes several efficient collection abstractions and a number of other useful modules. The software is free, and the book is worth buying.

Norman Ramsey