Initialize void pointer to point to an array
- by idealistikz
Suppose I have the following:
typedef struct {
int itemSize;
int count;
void *list;
} Mystruct;
Mystruct *InitStruct(int itemSize, int count)
{
Mystruct *my = malloc(sizeof(Mystruct));
my->itemSize = itemSize;
my->count = count;
//What is the best way to initialize list? For example:
//my->list = malloc(count *…