Hi all

Given the following structure
Code:
typedef struct value_pair {
        char                    name[40];
        int                      attribute;
        int                      type;
        int                     length; /* of strvalue */
        uint32_t              lvalue;
        LRAD_TOKEN     operator;
        uint8_t                 strvalue[MAX_STRING_LEN];
        ATTR_FLAGS      flags;
        struct value_pair   *next;
} VALUE_PAIR;
I am not understanding this small function
Code:
void pairadd(VALUE_PAIR **first, VALUE_PAIR *add)
{
        VALUE_PAIR *i;

        if (*first == NULL) {
                *first = add;
                return;
        }
        for(i = *first; i->next; i = i->next)
                ;
        i->next = add;
}
what for loop is doing???
this function is called in the following sequence
pairadd(&list, vp); where list and vp are again pointers of type VALUE_PAIR

thanks in advance

regards
punith

Last edited by shabbir; 19Sep2007 at 19:57.. Reason: Code block