#include <iostream>
#include <string>
using namespace std; //bad
struct namen{
string name;
namen *p_next;
};
namen add_name(namen *neuer_name, namen *liste){
neuer_name->p_next = liste;
cout<< neuer_name->name << " " << neuer_name->p_next->name <<endl;
return *neuer_name;
}
int main(){
namen erik;
erik.name = "erik";
erik.p_next = NULL;
namen lina;
lina.name = "lina";
namen mili;
mili.name = "mili";
namen thomas;
thomas.name = "thomas";
namen liste, liste2;
liste = add_name(&lina, &erik);
namen *p_liste = &liste;
cout<< liste.name << " " <<liste.p_next->name<< endl;
cin.get();
liste = add_name(&thomas, &liste);
liste = add_name(&mili, &liste);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOyAvL2JhZAoKICBzdHJ1Y3QgbmFtZW57CglzdHJpbmcgbmFtZTsKCW5hbWVuICpwX25leHQ7Cn07CgpuYW1lbiBhZGRfbmFtZShuYW1lbiAqbmV1ZXJfbmFtZSwgbmFtZW4gKmxpc3RlKXsKCW5ldWVyX25hbWUtPnBfbmV4dCA9IGxpc3RlOwoJY291dDw8IG5ldWVyX25hbWUtPm5hbWUgPDwgIiAiIDw8IG5ldWVyX25hbWUtPnBfbmV4dC0+bmFtZSA8PGVuZGw7CglyZXR1cm4gKm5ldWVyX25hbWU7Cn0KaW50IG1haW4oKXsKCW5hbWVuIGVyaWs7CgllcmlrLm5hbWUgPSAiZXJpayI7CgllcmlrLnBfbmV4dCA9IE5VTEw7CgluYW1lbiBsaW5hOwoJbGluYS5uYW1lID0gImxpbmEiOwoJbmFtZW4gbWlsaTsKCW1pbGkubmFtZSA9ICJtaWxpIjsKCW5hbWVuIHRob21hczsKCXRob21hcy5uYW1lID0gInRob21hcyI7CgluYW1lbiBsaXN0ZSwgbGlzdGUyOwoJbGlzdGUgPSBhZGRfbmFtZSgmbGluYSwgJmVyaWspOwoJbmFtZW4gKnBfbGlzdGUgPSAmbGlzdGU7Cgljb3V0PDwgbGlzdGUubmFtZSA8PCAiICIgIDw8bGlzdGUucF9uZXh0LT5uYW1lPDwgZW5kbDsKCWNpbi5nZXQoKTsKCWxpc3RlID0gYWRkX25hbWUoJnRob21hcywgJmxpc3RlKTsKCWxpc3RlID0gYWRkX25hbWUoJm1pbGksICZsaXN0ZSk7Cn0=