Thursday, November 24, 2005

Printing a list using recursion

This is a function for displaying a list. Oh I just love recursion.



void print_list(LINK head)
{
        if (head == NULL)
                printf("NULL");

        else {
                printf("%c --> ", head -> d;
                print_list(head -> next);
        }
}

No comments: