From: pereges on
Hi, I'm trying to create a generic link list. Here's the data
structure for node:
Code:

typedef struct node_s
{
void *data;
struct node_s *next;

}node;

Now let's say I want the data pointer to point to a vector structre:

Code:

typedef struct
{
double coord[3];

}vector;

I can assign data (of some random node in list) address of some
vector:

Code:

p->data = &v

p is pointer to node in link list and v is the vector.

But when I try an operation like this for eg:

Code:

p->data->coord[0] < p->data->coord[1]

It gives me an error. Is there any way I can solve this ? I have heard
you can't typecast a void pointer to some other data type