Results 1 to 6 of 6

Thread: Confused about wild pointer

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    Confused about wild pointer

    Hello Guys,

    I am learning the C programming language. In which the the pointer concept sound quit complex to understand. I want to know about the 'wild pointer'. I don't know what is the exact use of this type of pointer. If will be great if anybody provide some details about the 'wild pointer' with suitable example. I would really appreciate your any help over 'wild pointer'

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Confused about wild pointer

    Hi,

    In C programming the 'wild pointers' are also referred as 'dangling pointer'. In this type of pointer contains the location of the storage which is no longer allocated. Wild pointers created only if a pointer is used before to initialize the state. This type of mechanism also valid in some other programming languages. Basically the wild pointer is used to store the transient objects of the program.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Confused about wild pointer

    Hi friend,

    Refer following example which will demonstrate you the use of 'Wild pointer':
    Code:
    {
     char *cp1   NULL;
    
     {
      char c1;
      cp1= &c;
     } 
    } 
    
    {
     char *cp1,   malloc ( A_CONST );
    
     free ( cp1 );  /* cp now becomes a wild pointer */
     cp1 = NULL; 
     
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Confused about wild pointer

    Wild pointer used when corruption of the unrelated data occurs. And this may lead to the system instabilities. Wild pointers of C language is normally created by removal of the necessary initialization before it's utilization. This indecent always occurs because of the initialization jumping and can not be removed. In short the which doesn't enforce the start initialization is always called as 'wild pointer'. I hope this information will help you to aware about the wild pointer.

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Re: Confused about wild pointer

    The wild pointer is special type of pointer. This type of pointer is rarely used in the program. In following example the I have used the concept of wild pointer. Here 'px1' as well as the 'ax1' is declared as wild pointer.
    Code:
    void funx1( ax1 * px1)
    {
    int xi = px1->ix;
    delete px1;
    px1 = 0;
    }
    
    void funx2( ax1* px1)
    {
    int ix = px1->ix;
    }
    
    void main()
    {
    ax1* px1 = new ax1;
    ax1* px2 = px1;
    fun1( px1 );
    funx2( px2 );
    }

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Confused about wild pointer

    Hi friend,

    See something below can help you to understand wild pointer declaration :
    Code:
    {
    int* pzo1 = new int( 9 );
    
    int* pzo2 = pzo1;
    
    pzo1 = 0;
    
    }

Similar Threads

  1. is there anyone who likes wild arms 3?
    By MacKenz in forum Video Games
    Replies: 10
    Last Post: 04-01-2012, 10:28 PM
  2. Changing Stylus pointer to normal Pointer in Tablet PC
    By Kelley in forum Portable Devices
    Replies: 3
    Last Post: 21-06-2011, 07:22 PM
  3. Differentiation between void pointer and null pointer
    By Ram Bharose in forum Software Development
    Replies: 5
    Last Post: 18-01-2010, 12:11 PM
  4. How to use Wild Card Domain
    By ARTHUR18 in forum Technology & Internet
    Replies: 3
    Last Post: 18-05-2009, 10:52 AM
  5. HP goes wild with new mice and keyboards
    By Reegan in forum Portable Devices
    Replies: 7
    Last Post: 08-12-2008, 08:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,230,840.00222 seconds with 16 queries