Thus, we can also define a void pointer as a general-purpose pointer that can
point to any data type.
Applications of Void Pointers
Void pointers are used as parameters to functions that can operate on any type of memory. It is also
possible to return void pointers to assign to any of several different types of pointers.
Remember
that you cannot use a void pointer to dereference a variable unless you provide a type cast. It
means that if ‘vptr’ contains an address of an integer variable, then you cannot display its value
as:
printf(“void pointer is”, *vptr);
Do'stlaringiz bilan baham: |