Basically, I've defined and typedef'ed this struct:
typedef struct{
void** elements;
int numElements;
int itemSize;
int capacity;
int dynamicElements;
}array;
for which I've written accompanying dynamic array manipulation functions. However, I have a bit of a problem. In various functions, I pass this struct as an argument. In order to modularize the code, I need to prototype these functions in header files (and in order to allow arguments of type array, I need to include "array.h" in these header files themselves.)
So after including all of my header files, the "array.h" header file has been included multiple times. As would be expected, the struct type has been typedef'ed more than once, and causes conflicts.
My question is: how can I have this definition in my header file, such that it doesn't break if included multiple times?