Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct osoba{
- struct osoba *next;
- int wiek;
- int wzrost;
- };
- void wypisz(struct osoba*lista)
- {
- struct osoba*pom=lista;
- while(pom!=NULL)
- {
- printf("%d\n ",pom->wiek);
- printf("%d\n ",pom->wzrost);
- pom=pom->next;
- }
- }
- int main()
- {
- struct osoba *pocz;
- pocz=(struct osoba*)malloc(sizeof(struct osoba));
- pocz->wiek=5;
- pocz->wzrost=190;
- struct osoba *pom;
- pom=(struct osoba*)malloc(sizeof(struct osoba));
- pocz->next=pom;
- pom->wiek=6;
- pom->wzrost=160;
- struct osoba *trzeci;
- trzeci=(struct osoba*)malloc(sizeof(struct osoba));
- pom->next=trzeci;
- trzeci->wiek=7;
- trzeci->wzrost=123;
- trzeci->next=NULL;
- wypisz(pocz);
- return 0;
- }
Add Comment
Please, Sign In to add comment