I m making a C program that needs to use two stacks. One needs to hold chars, the other needs to hold doubles. I have two structs, node and stack:
struct node {
double value;
struct node *next;
struct node *prev;
};
struct stack {
struct node *last;
struct node *curr;
};
The problem is that I need one of each type. The only thing I can think of is having two separate structs (i.e., char_node, double_node, char_stack, double_stack). If this were C++ I d use templates, but of course I can t in C.
One thing I remember that could be used for this is a void pointer. Would that work, and would it be practical?