 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Pointer
To find the size of a void pointer, you can use the sizeof() operator that accepts a data type, variable name, or any value and returns its size. In this case, you need to pass the name of the void pointer.
Syntax
Following is the basic syntax of void pointer in C/C++:
sizeof(ptr)
Example Demonstrating Size of Void Pointer
In this example, we find out the size of void pointer using sizeof() function.
#include <stdio.h> int main() { void *ptr; printf("The size of pointer value : %zu", sizeof(ptr)); return 0; }  Output
The above program produces the following result:
The size of pointer value : 8
Explanation,
In the above example, a void type pointer variable is created using sizeof() function, the size of void pointer is found out.
Advertisements
 