#include <stdio.h>
#include <stdlib.h>

struct list {
    int key;
    struct list *next;
};

struct list *append(struct list **l1, int k)
{
    *l1 = malloc(sizeof *l1);
    (*l1)->key = k;
    return *l1;
}

int main(void)
{
    struct list *p, *l1, l2 = { 42, NULL }, l3 = { 24, NULL };
    int i;

    for (p = l1, i = 0; i < 42; ++i)
        p = append(&p, i);

    for (struct list *p = l1; p != NULL; p = p->next)
        printf("%d\n", p->key);
}
