I have a structure defined as:
typedef struct {
int type;
void* info;
} Data;
and then I have several other structures that I want to assign void * using the following function:
Data* insert_data(int t, void* s)
{
Data * d = (Data*)malloc(sizeof(Data));
d->type = t;
d->info = s;
return d;
}
struct {
...
} Struct#;
then i just call
insert_data(1, variable_of_type_Struct
When I compile this, a warning is issued
warning: assignment from incompatible pointer type
I tried applying the variable in the insert to (void *), but did not work
insert_data(1, (void *) variable_of_type_Struct#);
How can I get rid of this warning?
thank
source
share