top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is wild pointer in c and explain with programming?

+2 votes
509 views
What is wild pointer in c and explain with programming?
posted May 26, 2015 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

Uninitialized pointers are known as wild pointers because they point to some random memory location and may cause a program to crash or behave badly.

for example:

int main()
{
    int *ptr;      //this is a wild pointer.
    int a = 1;

    printf("Memory address of ptr : %p\n", ptr);  //it will print a random memory address.

    ptr = &a;      //Now its  not a wild pointer anymore.
    *ptr = 10;

    return 0;
}
answer May 27, 2015 by Arshad Khan
...