freeing memory allocated an array vacant pointers
i am dogmatic an array vacant pointers. any points value arbitary type.
void **values; // array vacant pointers any value arbitary type
initializing values follows:
values = (void**)calloc(3,sizeof(void*));
//can initialize values as: values = new void* [3];
int ival = 1;
boyant fval = 2.0;
char* str = "word";
values[0] = (void*)new int(ival);
values[1] = (void*)new float(fval);
values[2] = (void*)str;
//trying pristine memory allocated
free(*values);
//error: *** glibc detected *** simplesql: free(): unfair pointer: 0x080611b4
//core dumped
delete[] values*;
//warning: deletion 'void*' undefined
//similar error.
now i free/delete memory allocated values ( array vacant pointers)?
Comments
Post a Comment