Some thoughts
Code:
typedef enum {
isInt,
isString,
isDouble,
} data_et;
typedef struct field_st_tag {
char *fieldName;
data_et dataType;
struct field_st_tag *next;
} field_st;
typedef struct data_st_tag {
struct field_st_tag *field; /* what describes this field */
union {
int iValue;
char *sValue;
double dValue;
} u; /* all possible data types */
struct data_st_tag *next; /* the next field */
} data_st;
typedef struct data_row_st_tag {
struct data_st_tag *row; /* first field on this row */
struct data_row_st_tag *next; /* the next row */
} data_row_st;
So you would read the file, and create a linked list of fields.
For StudentName:string, StudentAge:int, you would allocate and initialise
two nodes of a linked list
{ "StudentName", isString },
{ "StudentAge", isInt }
You would then read the data file one record at a time, and then walk
your fields list to decide what type each record field should be.
Allocate a data_st and initialise it with the correctly converted result.
Use data_row_st to build up a linked list of linked lists of all your data.