I want to specify the type of an element as a parameter to initialize an array of pointers to an element of unknown types
sort of
void* init(type t) void* array = malloc(sizeof_type(t)*10)); return array; }
and then call for example
init(typeof(int))
But I could not understand what a return type is.
I think sizeof_type can be achieved with
malloc((type) 0);
Thanks in advance
PS: this, if for a vector implementation, if someone can point me to some kind of flexible code, I would also be very grateful
source share