I really dont understand the typecasting part of this... Im getting alot of errors..
Can anyone tell me why and how I can fix it?
** I have to use the void stars..
Code:
typedef struct _stacknode{
void *value;
struct _stacknode *next;
struct _stacknode *prev;
}STACKNODE;
typedef struct _stack{
struct _stacknode *sent;
}STACK;
void push(void *value, void *stack)
{
STACK *new_node;
new_node = (STACK *)malloc(sizeof(STACK));
stack->prev->next = new_node;
new_node->prev = stack->prev;
stack->prev = new_node;
new_node->next = stack;
}