6

Is there something like a standard implementation of a list in C? I am not finding anything in the standard libraries.

Do you have a recommendation of a c library that implements standard data types like list, map etc.? I am searching for a slim one-file solution.

Erik
  • 11,944
  • 18
  • 87
  • 126
  • Linux's `list.h` - I'd link it but I'm on my phone, you can find it easily if you Google "linux list.h". – Chris Lutz Mar 14 '12 at 18:22
  • 1
    Just to be clear, you are looking for a library that offers all standard data types (lists and maps are only two examples of data structures, but why would it contain these and not queues, heaps, ...?), and you hope it will be slim and fit in one file? Weird things exists out there, and you may even find a one-file library, but it will be one huge file and the library won't be better for it. – Pascal Cuoq Mar 14 '12 at 18:25
  • See also: http://programmers.stackexchange.com/questions/116650/is-there-any-boost-equivalent-library-for-c – Ciro Santilli OurBigBook.com Jul 27 '15 at 15:05

3 Answers3

5

Many unix systems have a few different implementations in sys/queue.h

Erik Ekman
  • 2,051
  • 12
  • 13
4

The GLib library contains plenty of data structures including linked lists and, for maps, hash tables and balanced binary trees. I'm unsure whether you will consider it “slim”, though.

Pascal Cuoq
  • 79,187
  • 7
  • 161
  • 281
0

See the Linux Kernel Linked List in this answer to a question about multi-purpose linked lists

Community
  • 1
  • 1
AShelly
  • 34,686
  • 15
  • 91
  • 152