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

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

void append(struct list *l1, struct list l2)
{
    l1 = malloc(sizeof *l1);
    *l1 = l2;
    l1->next = NULL;
}

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

    append(l1, l2);
    append(l1->next, l3);

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