typedefs and header files
Hi all!
I was wondering if there was a way to defer typedef declaration untill a later time? Now what I'm trying to do is create a general linked list .c & .h file of all the definitions and functions of a list such as listempty, traverselist, createlist etc. However, I want to keep it as general as possible including the data type of the list untill I need it for one of my projects.
Now I've read a textbook on this subject and it's say's I can declare the datatype just before including the header file of the general list like so:
typedef MyDataType GeneralDataType;
#include "general_list.h"
where: GeneralDataType is undefined and part of a structure in general_list.h and MyDataType is a clearly defined datatype such as char, int or some other structure.
The problem I'm having is that general_list.c complains that I haven't defined what GeneralDataType is even though I have defined it in the header file of a main program.
Is there a work around or preprocessor command I'm missing? Any help would be greatly appreciated.