pointer that does not point to a valid object
Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. These are special cases of memory safety violations. More generally, โ€ฆ Wikipedia
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Dangling_pointer
Dangling pointer - Wikipedia
3 weeks ago - Dangling pointers and wild pointers in computer programming are pointers that do not point to a valid object of the appropriate type. These are special cases of memory safety violations. More generally, dangling references and wild references are references that do not resolve to a valid ...
Top answer
1 of 11
55

The standard does not define or use the term "wild". I'd be careful "correcting" other people's opinions about what it means, and I'd especially avoid quoting random non-normative internet junk to support my position.

To me, it would mean a pointer that neither refers to a legitimate object, nor is NULL. Possible sources of these types of pointer values might include uninitialized pointer objects, objects that have ceased to exist, computed pointer values, improperly aligned pointer values, accidental corruption of the pointer itself, or what it pointed to, etc.

int main(void)
{

   int *p;  // uninitialized and non-static;  value undefined
   { 
      int i1; 
      p = &i1;  // valid 
   }            // i1 no longer exists;  p now invalid    

   p = (int*)0xABCDEF01;  // very likely not the address of a real object

   { 
      int i2;  
      p = (int*)(((char*)&i2) + 1);  // p very likely to not be aligned for int access
   }

   {
      char *oops = (char*)&p;  
      oops[0] = 'f';  oops[1] = 35;  // p was clobbered
   }
}  

and so on, and so forth. There are all kinds of ways to get an invalid pointer value in C. My favourite has got to be the guy who tried to "save" his objects by writing their addresses to a file. Strangely, when he read back those pointer values during a different run of the program, they didn't point to his objects any more. Fancy, that.

But that's just what wild means to me. Since it's not a normative term, it means whatever the person who spoke or wrote it meant it to mean. Ask him or her.

2 of 11
13

A wild pointer in C is a pointer that has not been initialised prior to its first use. From Wikipedia:

Wild pointers are created by omitting necessary initialization prior to first use. Thus, strictly speaking, every pointer in programming languages which do not enforce initialization begins as a wild pointer.

This most often occurs due to jumping over the initialization, not by omitting it. Most compilers are able to warn about this.

eg

int f(int i)
{
    char* dp;    //dp is a wild pointer
    ...
}
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ dsa โ€บ what-are-wild-pointers-how-can-we-avoid
What are Wild Pointers? How can we avoid? - GeeksforGeeks
January 15, 2026 - Uninitialized pointers are known as wild pointers because they point to some arbitrary memory location and may cause a program to crash or behave unexpectedly.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ what-are-wild-pointers-in-c-cplusplus
What are Wild Pointers in C/C++?
April 21, 2025 - In C, a wild pointer is a pointer that has not been initialized to a valid memory address. When a pointer is declared but not assigned a value, it contains garbage data and points to an unknown memory location, making it unpredictable and dangerous
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ dangling-void-null-wild-pointers
Dangling, Void , Null and Wild Pointers in C - GeeksforGeeks
January 10, 2025 - A pointer that has not been initialized to anything (not even NULL) is known as a wild pointer.
๐ŸŒ
DEV Community
dev.to โ€บ godinhojoao โ€บ wild-and-dangling-pointers-in-c-3kj5
Wild and Dangling Pointers in C - DEV Community
October 11, 2025 - Dangling Pointer: A pointer that ... memory). Accessing it is undefined behavior. Wild Pointer: A pointer that has not been initialized, pointing to random memory....
Find elsewhere
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ what is wild pointer in c?
What is Wild Pointer in C? - Scaler Topics
September 4, 2023 - We initialize the pointer variable ... concept of wild pointers is they are almost the same as a normal pointer variable, the only difference is, that they are an uninitialized pointer variable, meaning they are not initialized ...
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ wild pointer
r/C_Programming on Reddit: wild pointer
October 1, 2024 -
{
   char *dp = NULL;
   
/* ... */
   {
       char c;
       dp = &c;
   } 
     
/* c falls out of scope */
     
/* dp is now a dangling pointer */
}

In many languages (e.g., the C programming language) deleting an object from memory explicitly or by destroying the stack frame on return does not alter associated pointers. The pointer still points to the same location in memory even though that location may now be used for other purposes.
wikipedia

so what is the problem if this address allocated with the same or different data type again

Q :

is that the same thing

#include <iostream>
int main(){
    int x=4;
    int *i=&x;
    char *c=(char*)&x;
    bool *b=(bool*)&x;
    } 
๐ŸŒ
Aticleworld
aticleworld.com โ€บ home โ€บ blog post โ€บ what are wild pointers in c and how can we avoid?
What are wild pointers in C and How can we avoid? - Aticleworld
April 15, 2020 - What are wild pointers in C: Uninitialized pointers are known as wild pointers.Behavior of Uninitialized pointer is undefined and may cause of code crash.
๐ŸŒ
Aticleworld
aticleworld.com โ€บ home โ€บ dangling, void , null and wild pointer in c
Dangling, Void , Null and Wild Pointer in C - Aticleworld
May 25, 2021 - A pointer that is not initialized properly prior to its first use is known as the wild pointer.
๐ŸŒ
YouTube
youtube.com โ€บ neso academy
Understanding the Wild Pointers - YouTube
Data Structures: Understanding the Wild PointersTopics discussed:1) What is a Wild Pointer?2) An example Wild Pointer.3) How to avoid the Wild Pointers?C Pro...
Published ย  May 12, 2020
๐ŸŒ
Quora
quora.com โ€บ What-is-wild-pointer-in-c
What is wild pointer in c? - Quora
Answer (1 of 5): The uninitialized pointer are called as wild pointer. 1. Wild pointer pointing to some valid garbage address that should not be accessed.If we are trying to access it then there is a chance if system crash.
๐ŸŒ
CodeSpeedy
codespeedy.com โ€บ home โ€บ wild pointers in c++
What are Wild Pointers in C++ and how to avoid them- CodeSpeedy
December 7, 2020 - Wild pointers are slightly different from normal pointers i.e. although even wild pointers store the memory addresses but point to some unallocated memory or some arbitrary location or data value.
๐ŸŒ
CodeWithHarry
codewithharry.com โ€บ tutorial โ€บ c-wild-pointer
Wild Pointer | C Tutorial | CodeWithHarry
Uninitialized pointers are known as wild pointers because they point to some arbitrary memory location while they are not assigned to any other memory location.
๐ŸŒ
PrepBytes
prepbytes.com โ€บ home โ€บ c programming โ€บ wild pointers in c
Wild Pointers in C
March 30, 2023 - In C programming language, a wild pointer is an uninitialized pointer that contains a random memory address that may point to a non-existent or invalid memory location. Therefore, it is important for C programmers to always initialize pointers ...
๐ŸŒ
YouTube
youtube.com โ€บ rapid tutor
12 - Wild Pointers Explained - YouTube
#Pointers #WildPointers #DSA #CProgramming #DynamicMemory Wild pointers are uninitialized pointers that point to arbitrary memory locations, leading to progr...
Published ย  January 14, 2025
Views ย  12
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ dangling-void-null-and-wild-pointers-in-c-cplusplus
Dangling, Void, Null and Wild Pointers in C++
April 17, 2025 - The value of pointer is 0. Wild pointers are pointers those are point to some arbitrary memory location.
๐ŸŒ
Sankalandtech
sankalandtech.com โ€บ Tutorials โ€บ C โ€บ wild-pointer-c.html
Wild Pointers in C programming.
In C programming, a wild pointer refers to a pointer that has not been initialized or that points to an invalid memory location. When a pointer is considered wild, it means that its value is unpredictable and can lead to unexpected behavior when dereferenced.
๐ŸŒ
Quora
quora.com โ€บ What-is-a-wild-pointer-in-the-C-language
What is a wild pointer in the C language? - Quora
Answer (1 of 2): In the C programming language, a "wild pointer" is a pointer that holds an invalid memory address, i.e., a memory address that does not point to a valid object or variable.