Question is relevant.
For the below representation,
typedef struct List{
void **array; // array of void*
int lastItemPosition;
int size;
}List;
#define INITIAL_LIST_SIZE 50
createList
performs as shown below,
List *createList(List *list, Op opType){
List *lptr = (List *)malloc(sizeof(List));
if(opType == CREATE_NEW_LIST){
lptr->array = malloc(INITIAL_LIST_SIZE*sizeof(void*));
lptr->array = memset(lptr->array, NULL, INITIAL_LIST_SIZE*sizeof(void *));
lptr->lastItemPosition = -1;
lptr->size = INITIAL_LIST_SIZE;
}
Is memset
performing valid operation on lptr->array
?