A Python dict
and a C struct
are very different beasts.
A struct
can be thought of as a way to group related variables together, so that they can be passed around as a single unit.
A dict
is a mapping from keys to values, where the set of keys is generally not known at compile time. If you need to do something similar in C, your best bet is probably to use a library of standard data structures. These have been discussed in the past: Are there any open source C libraries with common data structures?
There are several standard data structures that can enable one to map keys to values. A hash table is a sensible default choice.