void 포인터의 배열을 선언하고 있습니다. 각각은 임의의 유형의 값을 가리 킵니다. 다음과 같이
void **values; // Array of void pointers to each value of arbitary type
void 포인터의 배열에 할당 된 메모리를 해제합니다.
값을 초기화 :
values = (void**)calloc(3,sizeof(void*));
//can initialize values as: values = new void* [3];
int ival = 1;
float fval = 2.0;
char* str = "word";
values[0] = (void*)new int(ival);
values[1] = (void*)new float(fval);
values[2] = (void*)str;
//Trying to Clear the memory allocated
free(*values);
//Error: *** glibc detected *** simpleSQL: free(): invalid pointer: 0x080611b4
//Core dumped
delete[] values*;
//warning: deleting 'void*' is undefined
//Similar Error.
을 이제 어떻게 무료로 할/값에 할당 된 메모리 (무효 포인터의 배열)을 삭제 하시겠습니까?
아마도 : 값 = (void **) calloc (3, sizeof (void *)); – botismarius