ProAnswers.org

What is wild pointer in c?

1 Like

A pointer in c which has not been initialized is known as wild pointer.

see this

void main()
{
int *ptr;
printf("%u
“,ptr);
printf(”%d",*ptr);

}

Output: Any address
Garbage value

Wild pointers are pointers that have not been initialized and can make a program crash.

This is due to fact that in C programming language, pointers that are not specifically initalized, point to any random address in memory.



 



void main()
{
int *ptr;
printf("%u

“,ptr);
printf(”%d",*ptr);

}

Output: Any address
Garbage value