The size of a void* is a platform dependent value. Typically it's value is 4 or 8 bytes for 32 and 64 bit platforms respectively. If you are getting 2 as the value then your likely running on a 16 bit coding platform (or potentially have a coding error).

Could you post the code you are using and some more information about your environment / operating system?

Answer from JaredPar on Stack Overflow
🌐
TutorialsPoint
tutorialspoint.com › what-is-the-size-of-void-pointer-in-c-cplusplus
What is the size of void pointer in C/C++ ?
The size of void pointer varies system to system. If the system is 16-bit, size of void pointer is 2 bytes. If the system is 32-bit, size of void pointer is 4 bytes. If the system is 64-bit, size of void pointer is 8 bytes. Finding Size of a Void Poi
People also ask

Can you delete a void pointer?
The delete operator in C++ or the free() function in C cannot calculate the proper deallocation size for a void pointer because it lacks type information. You must first convert memory allocated via a void pointer to the relevant data type before using the proper deallocation function (such as delete for C++ objects or free() for dynamically allocated memory) to properly release the memory. What is the size of a void pointer in C?
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › void pointer
Mastering Void Pointers: A Comprehensive Tutorial
What cannot be done on the void pointer?
In C or C++, you cannot directly dereference or execute pointer arithmetic on a void pointer ('void*'). Additionally, until you explicitly convert the data to the correct data type, you cannot access the data it points to. To access the underlying data safely, void pointers must first be cast to the correct type because they lack type information. Can you delete a void pointer?
🌐
upgrad.com
upgrad.com › home › tutorials › software & tech › void pointer
Mastering Void Pointers: A Comprehensive Tutorial
🌐
Reddit
reddit.com › r/c_programming › how to find the sizeof whatever a void pointer is pointing to?
How to find the sizeof whatever a void pointer is pointing to? : r/C_Programming
September 19, 2020 - C requires explicit type definitions at compile time. There wouldn't be a context in which you can determine the width of data without seeing where it originates.
🌐
Scaler
scaler.com › topics › void-pointer-in-c
Void Pointer in C - Scaler Topics
October 18, 2022 - Void pointers in C are a special ... ... The size of void pointers varies from machine to machine, but in general they are 4 bytes in 32-bit systems and 8 bytes in 64-bit systems...
🌐
Quora
quora.com › What-is-size-of-void-pointer
What is size of void pointer? - Quora
On a 64-bit Ubuntu system with an 8 GB RAM (my system), this size is 8 bytes. This is the size of void pointers, int pointers, and char pointers alike, even long pointers and float pointers.
🌐
upGrad
upgrad.com › home › tutorials › software & tech › void pointer
Mastering Void Pointers: A Comprehensive Tutorial
October 27, 2025 - The size of a void pointer ('void*') in C depends on the platform. It normally has the same size as a system regular pointer, which on a 32-bit system is typically 4 bytes and on a 64-bit system is often 8 bytes.
🌐
Medium
medium.com › @sumeet2703 › why-void-has-no-size-a-deep-dive-into-c-and-c-34104f886c00
Why void Has No Size: A Deep Dive into C and C++ | by Sumeet K | Medium
September 4, 2024 - ... The sizeof operator is used to determine the size, in bytes, of a data type or variable in C and C++. It is evaluated at compile time and returns the size of the specified type or object.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › c language › void-pointer-c-cpp
void Pointer in C - GeeksforGeeks
2. The C standard doesn't allow pointer arithmetic with void pointers. However, in GNU C it is allowed by considering the size of the void as 1.
Published   July 17, 2014
🌐
HackerEarth
hackerearth.com › practice › notes › void-pointer-in-c
void pointer in C | HackerEarth
2) The C standard doesn’t allow pointer arithmetic with void pointers. However, in GNU C it is allowed by considering the size of void is 1.
🌐
Unstop
unstop.com › home › blog › void pointer in c explained in detail with code examples
Void Pointer In C Explained In Detail With Code Examples // Unstop
March 1, 2024 - The size of the void pointer on a 64-bit system is 8 bytes. The sizeof() operator can be used to determine the size of a void pointer in C.
🌐
Javatpoint
javatpoint.com › void-pointer-in-c
Void Pointer in C - javatpoint
It determines the size of the expression or the data type specified in the number of char-sized storage units. The sizeof() operator contains a single operand which can be either an expression or a data typecast where the... ... As we know that we can create a pointer of any data type such as int, char, float, we can also create a pointer pointing to a function.
🌐
PrepBytes
prepbytes.com › home › c programming › void pointer in c
Void Pointer in C
January 8, 2024 - Before swap: x = 5, y = 10 After swap: x = 10, y = 5 Before swap: a = 1.500000, b = 2.500000 After swap: a = 2.500000, b = 1.500000 Before swap: c1 = a, c2 = b After swap: c1 = b, c2 = a · Explanation In the above example, the swap() function is implemented using a void pointer. The function accepts two void pointers, ‘ptr1’ and ‘ptr2’, and a size_t variable ‘size’ that specifies the size of the data being swapped.
🌐
Sankalandtech
sankalandtech.com › Tutorials › C › void-pointer-c.html
void Pointers in C programming.
The size of void pointer is implementation-dependent. the size of a void pointer is equal to the size of a regular pointer on the system. This means that on a 64-bit system, a void pointer would be 8 bytes in size, while on a 32-bit system, a void pointer would be 4 bytes in size. sizeof operator ...
🌐
Cprogramming
cboard.cprogramming.com › c-programming › 120181-void-**-sizeof-void*-what.html
void ** ?? sizeof(void*)?? what is this?
You have 4 such pointers. The first will point on the first byte of the 12 bytes that imgtmp->data points, the second on the 4th, the third on the 8th and the fourth on the 12th byte. That way you can use imgtmp->pdata with indexes to get whichever byte you mean.
🌐
BYJUS
byjus.com › gate › void-pointer-in-c
Void Pointer in C
August 1, 2022 - But its size varies a lot on the basis of the platform on which we are using it in the code. Let us take a look at an example to understand this better. ... We cannot use it dereferenced. The arithmetic of pointers isn’t possible in the case of void pointers because of their concrete size.
🌐
Dot Net Tutorials
dotnettutorials.net › home › void pointer in c
Void Pointer in C Language with Examples - Dot Net Tutorials
November 17, 2023 - It is a flexible tool, especially useful in scenarios that require a function to handle different data types or when dealing with raw memory. The Size of the void pointer is 2 bytes.
🌐
Sololearn
sololearn.com › en › Discuss › 2011645 › what-is-the-size-of-void-pointer
What is the size of void pointer? | Sololearn: Learn to code for FREE!
Void pointers are generally used while assigning dynamic memory using malloc() 2408 · 22nd Sep 2019, 4:36 AM · suyash sonkesaria · 2 Answers · Answer · + 1 · What is that 2 4 0 8 in Relevant Tags? choices for pointer size? did that help ...