As we found out in the comments, the problem was that the definition of struct T happened after the definition of T in the header. You really have things back. The header should define all types and prototypes of functions, and your C files should use them.
Instead, you want to change the signature of the insert function to get a pointer to your data and data size. Then you can allocate some memory for the data, copy it and save. You don't need a specific type, just declare it void * .
void listInsertFirst(void *data, size_t data_size, int key, LinkedList* ListToInsertTo);
Then the caller will do something like this:
struct T { int foo; }; struct T x = { ... }; int someKey = ...; LinkedList *someList = ...; listInsertFirst(&x, sizeof x, someKey, someList);
source share