Thread: Internal working of this code...

  1. #1
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002

    Internal working of this code...

    Well consider i have a structure as follows

    struct list{
    struct list *next[5];

    now while adding new elements...

    previous->next[i]=new struct list;

    this will create a list and so on.. beofre the above statement previous->next[i] was equal to NULL... now consider I have a function as follows

    void function(struct *list)
    //this function will further build a tree below list
    list=new struct list //and so on
    list->next[i]=new struct list; //etc etc etc
    now calling where previous->next[i] is NULL
    when the above is done the previous node holds no information of the tree below unless I pass the function with a pointer already pointing to a structure... why is this.... I know i have not explained things clearly but feel free to ask questions ........

  2. #2
    Registered User
    Join Date
    Nov 2001
    One solution is a pointer to a pointer.

    void function(Structlist **pPreviousList)


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem with previously working internet code
    By abachler in forum Windows Programming
    Replies: 11
    Last Post: 04-10-2009, 04:11 AM
  2. Code not working?
    By Elysia in forum C++ Programming
    Replies: 12
    Last Post: 04-06-2009, 01:57 AM
  3. Replies: 3
    Last Post: 02-24-2009, 08:49 PM
  4. C code not working
    By D3ciph3r in forum C Programming
    Replies: 2
    Last Post: 05-27-2005, 04:13 PM
  5. Trying to eject D drive using code, but not working... :(
    By snowfrog in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 07:47 PM