Page 16 - Sample_test_Float
P. 16

16  Functions and Pointers


              5.2.13. 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?
               #include<stdio.h>
               void main()
               {
                  int *p;
                  printf(“%u\n”,p);
               }

               Output
               28618



              Here the output is just any random address (Garbage value)

              Here p is wild pointer because it has not been initialized. Wild pointer doesn’t point any specific memory
              location.


              5.2.14. Dangling Pointer
              If a pointer is pointing to the memory address of a variable and after sometimes, if the variable has been deleted
              from that memory location, then the pointer will still be pointing to the same memory location. Such pointer is
              known as dangling pointer and this problem is known as dangling pointer problem.
              Initially:


                                                  ptr                   a



                                                 5000                   25



                                                 8000                  5000

              Later:


                                                  ptr                   a



                                                 5000                   25



                                                 8000                  5000
   11   12   13   14   15   16   17