Ok, this is an easy question...but it's annoying me,

How do i pass by reference? i want to pass a pointer to a struct into a
function, have the function modify the pointer to point somewhere else, and
pass back the new pointer:

mystruct *pointer, *head;

void Modify (mystruct *input)
{
        Modify_the_pointer; /* i'm dealing with a linked list, so lets say i
                                                        want it to point to the next 
one and return
                                                        the address of that element */
        input = new_location_in_list;
}

void main (void)
{
        malloc head;

        assign some data;
        make pointer point to head
        modify (pointer)
        /* pointer now wants to point to next one */
}


i've tried doing that but get errors about passing incompatible pointer
types and making pointers from integers without casting.

-[[EMAIL PROTECTED]]-------------------------------------------------
Http://x-map.home.ml.org                  Mailto : [EMAIL PROTECTED]
---[Quote Of The Day]----------------------------------------------------------
-------------------------------------------------------------------------------

Reply via email to