home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- extern char *malloc();
-
- typedef struct person {
- char name[20]; /* hier nur ein Feld */
- struct person *next;
- } PERSON;
-
- PERSON *pp,*anfang;
- main()
- {
- char c;
- anfang = pp = (PERSON *)malloc(sizeof(PERSON));
-
- do {
- puts("Bitte Namen eingeben!");
- gets(pp -> name);
- pp -> next = (PERSON *)0;
- pp = pp -> next = (PERSON *)malloc(sizeof(PERSON));
- } while((c = getchar()) != 'e');
-
- pp = anfang;
- do
- puts(pp -> name);
- while(pp = pp -> next);
- while((c = getchar()) != 'e')
- ;
- /* an sich müssen die Speicherbereiche wieder freigegeben werden */
- }
-