How does one construct and access a set of key-value pairs in C? To use a silly simple example, let\'s say I want to create a table which translates between an integer and i
You could also use the libghthash for general purpose hashes. They are quite easy to use, and incorporate in your application. However, it is a third party API - so if that's a problem, you would have to implement your own.
There's no built in associate array/hash tables in C.
The array initialization (C99) is probably the best way to go unless you have non-numeric keys:
T hash[] = {
[1] = tObj,
[255] = tObj2,
};