Difference between Dangling pointer and Void pointer Last Updated : 13 Jul, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Dangling pointer: A pointer pointing to a memory location that has been deleted (or freed) is called a dangling pointer. There are three different ways where Pointer acts as a dangling pointer: By deallocating memoryFunction CallWhen the variable goes out of scope Void pointer: Void pointer is a specific pointer type – void * – a pointer that points to some data location in storage, which doesn’t have any specific type. Void refers to the type. Basically, the type of data that it points to can be any. If we assign the address char data type to a void pointer, it will become a char Pointer, if int data type, then int pointer, and so on. Any pointer type is convertible to a void pointer. Hence, it can point to any value. Below are some important points regarding void pointers: void pointers cannot be dereferenced. However, it can be done using typecasting the void pointerPointer arithmetic is not possible on pointers of void due to lack of concrete value and size.Tabular Difference Between Dangling Pointer and Void Pointer: Dangling Pointer Void Pointer A dangling pointer is a pointer that occurs at the time when the object is de-allocated from memory without modifying the value of the pointer.A void pointer is a pointer that can point to any data type.It points to the deleted object.A void pointer can be assigned the address of any data type.It usually occurs at the object destruction time.The representation of a pointer to the void is the same as the pointer of the character type.Dangling pointer errors can only be avoided just by initializing the pointer to one NULL value.A void pointer can store an object of any type.The dangling pointer will be with a free() function in C.It is also called a general-purpose pointer. Comment More infoAdvertise with us Next Article Difference between Dangling pointer and Void pointer A anuragtarang60 Follow Improve Article Tags : Difference Between C Language pointer Pointers Practice Tags : Pointers Similar Reads Difference between int* p() and int (*p)()? A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, a pointer must be declare before storing any variable address. The general form of a pointer variable declaration is: Syntax: type *var_name; Here, type 2 min read Difference between pointer to an array and array of pointers Pointer to an array: Pointer to an array is also known as array pointer. We are using the pointer to access the components of the array. int a[3] = {3, 4, 5 }; int *ptr = a; We have a pointer ptr that focuses to the 0th component of the array. We can likewise declare a pointer that can point to whol 4 min read Difference between int *a and int **a in C In C, the declarations int *a and int **a represent two different concepts related to pointers. Pointers play a fundamental role in memory management and data manipulation in C programming so it is important to have a clear understanding of them. What does int * means? This declares a pointer to an 3 min read Difference between "int main()" and "int main(void)" in C/C++? Note: This was true for older versions of C but has been changed in C11 (and newer versions). In newer versions, foo() is same as foo(void). Consider the following two definitions of main(). Definition 1: C int main() { /* */ return 0; } C++ int main() { /* */ return 0; } Definition 2: C int main(vo 3 min read Dangling, Void , Null and Wild Pointers in C In C programming pointers are used to manipulate memory addresses, to store the address of some variable or memory location. But certain situations and characteristics related to pointers become challenging in terms of memory safety and program behavior these include Dangling (when pointing to deall 6 min read Like