I'm currently writing a header file data_structures.h that contains several different data structures such as dynamic arrays and trees. My problem is, that I want to have a function like get_element() that can be both called with an instance of a dynamic array or a tree or any other data structure.
I know that there is no such thing as function overloading in C, but are there any best practice methods to get around this problem? Would it be best to just have another function name for each data structure, for example tree_get_element()?
int get_element(struct dynarray *a, int index); int get_element(struct tree *t, int index);