Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to represent a Python-like dictionary in C

Tags:

c

dictionary

In Python it's easy:

x = {}
x['USD'] = "Dollars"
x['CLP'] = "Pesos"

or

y = {'lat': 23.678900, 'lng': 121.451928, 'name': "Sin City"}

I think most of these kinds of problems have been solved, so where can I get information about dictionaries in C? I do not want to reinvent the wheel.

How do I implement a dictionary in C?

like image 778
ccarpenterg Avatar asked Jul 17 '10 01:07

ccarpenterg


1 Answers

glibc provides hcreate, hsearch, and hdestroy.

like image 174
William Pursell Avatar answered Oct 20 '22 01:10

William Pursell