Monday 10 February 2020

What is the difference between NULL and Void Pointer? tccicomputercoaching.com

A null pointer is basically a null value assigned to a pointer of any data type whereas a void pointer is a data type which remains void as long as an address of a data type is not assigned to it.

The data type of the pointer is nothing but the type of data stored at the memory location where the pointer is pointed. When you are not sure about the type of data that is going to store at a particular memory location, you need to create the void pointer.



Null pointer does not contain a reference of any variable/value. Hence we may state that it has a NULL as its value making it a null pointer.

void pointer is always of type void *

Mainly such pointers are used for dynamic memory allocations (using malloc(), calloc() and realloc() functions) , where memory block reserved is pointer to by a void pointer and as the pointer value is returned it has to be explicitly type casted to a particular desired type.

Student of IT Field can update their Programming knowledge at TCCI.

For more information about TCCI,.

Call us @ 9825618292

Visit us @ www.tccicomputercoaching.com

No comments:

Post a Comment