void pointer in c with easy example

void pointer in C

In this program, you will know the concept of void pointer and get the example code of void pointer in c programming.

What is void pointer

void pointer is a type of pointer in C/C++. It does not point to a specific data type. It can be used as a generic pointer, Which can point to any data type. It is typically used for passing pointers to functions. It is also used to allocate memory or refer to data without knowing its type.

void pointers are declared by using the keyword void as the base type.

For example:

void *ptr;

void pointers are not associated with any particular data type. It can be used to point to any other types of data in memory.
Below is an example of declaring and using a void pointer:

void pointer in c example

Output

void pointer in c

 

 

 

Check out our other C programming Examples

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top