Null pointers and void pointers are completely different from each other. If we request the operating system (via malloc () in c langauge) to allocate memory for a specific data type, then the operating system allocates memory in the heap (if space is available on the heap) and sends the address of the allocated memory.
When memory is allocated os on the heap, we can assign this address value to any variable of pointer type of this data type. This pointer is then called the void pointer until it is accepted for any process.
When space is not available on the heap, the operating system, of course, allocates memory and sends the address value of this location, but this memory is not allocated on the os heap because there is no space on the heap, in this case this memory is allocated os in the system memory. This memory cannot be accessed by the user, therefore, when we assign this address value in a pointer, this pointer is known as a null pointer, and we cannot use this pointer. In the case of the void pointer, we can use it for any process in any programming language.
Ghulam Rabbani Sep 10 2018-12-12T00: 00Z
source share