×
Home
Next Lec →
← Previous Lec
C Programming
Wild Pointer
What is a Wild Pointer
Uninitialized pointers are known as wild pointers
These pointers point to some arbitrary location in memory and may cause a program to crash or behave badly.
Dereferencing wild pointers can cause nasty bugs
It is suggested to always initialize unused pointers to NULL.
An example Program
In the following program, ptr is a wild pointer until it is given the address of a.
int a; int *ptr; ptr = &a; // ptr is no longer wild