What Is Wild Pointer

  Wild pointer:

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

    Example:

   What will be output of following c program?



  1. #include<stdio.h>
  2.  int main()
  3.  {
  4.     int *ptr;
  5.     printf("%u\n",ptr);
  6.     printf("%d",*ptr);
  7.     return 0;
  8.    }
                                                                                         


         Output:


  Any address

Garbage value


Here ptr is wild pointer because it has not been initialized.

0 comments:

Post a Comment

Don't Forget to comment