void 포인터의 크기는 시스템마다 다릅니다. 시스템이 16비트인 경우 void 포인터의 크기는 2바이트입니다. 시스템이 32비트인 경우 void 포인터의 크기는 4바이트입니다. 시스템이 64비트인 경우 void 포인터의 크기는 8바이트입니다.
다음은 C 언어에서 void 포인터의 크기를 찾는 예입니다.
예시
#include <stdio.h>
int main() {
void *ptr;
printf("The size of pointer value : %d", sizeof(ptr));
return 0;
} 출력
The size of pointer value : 8
위의 예에서는 void형 포인터 변수를 생성하고 sizeof() 함수를 이용하여 void형 포인터의 크기를 알아낸다.
void *ptr;
printf("The size of pointer value : %d", sizeof(ptr));