#include <stdio.h>
#include <stdlib.h>
typedef struct tag_List {
struct tag_List *next;
int val;
} List;
void init(List *);
void add(List *, int);
int main()
{
List ob_root;
List *p;
init(&ob_root);
add(&ob_root, 1);
add(&ob_root, 2);
add(&ob_root, 3);
for (p = &ob_root; NULL != p->next; p = p->next) {
}
return 0;
}
void init(List * p)
{
p->next = NULL;
p->val = 0;
}
void add(List * pob_root, int v)
{
List *p;
for (p = pob_root; NULL != p->next; p = p->next) {
;
}
p->val = v;
init(p->next);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnR5cGVkZWYgc3RydWN0IHRhZ19MaXN0IHsKICAgIHN0cnVjdCB0YWdfTGlzdCAqbmV4dDsKICAgIGludCB2YWw7Cn0gTGlzdDsKCnZvaWQgaW5pdChMaXN0ICopOwp2b2lkIGFkZChMaXN0ICosIGludCk7CgppbnQgbWFpbigpCnsKICAgIExpc3Qgb2Jfcm9vdDsKICAgIExpc3QgKnA7CgogICAgaW5pdCgmb2Jfcm9vdCk7CiAgICBhZGQoJm9iX3Jvb3QsIDEpOwogICAgYWRkKCZvYl9yb290LCAyKTsKICAgIGFkZCgmb2Jfcm9vdCwgMyk7CgogICAgZm9yIChwID0gJm9iX3Jvb3Q7IE5VTEwgIT0gcC0+bmV4dDsgcCA9IHAtPm5leHQpIHsKICAgICAgICBwcmludGYoIiVkXG4iLCBwLT52YWwpOwogICAgfQogICAgcmV0dXJuIDA7Cn0KCnZvaWQgaW5pdChMaXN0ICogcCkKewogICAgcC0+bmV4dCA9IE5VTEw7CiAgICBwLT52YWwgPSAwOwp9Cgp2b2lkIGFkZChMaXN0ICogcG9iX3Jvb3QsIGludCB2KQp7CiAgICBMaXN0ICpwOwogICAgZm9yIChwID0gcG9iX3Jvb3Q7IE5VTEwgIT0gcC0+bmV4dDsgcCA9IHAtPm5leHQpIHsKICAgICAgICA7CiAgICB9CiAgICBwLT52YWwgPSB2OwogICAgcC0+bmV4dCA9IG1hbGxvYyhzaXplb2YoKnApKTsKICAgIGluaXQocC0+bmV4dCk7Cn0K