#include <stdio.h> #include <stdlib.h> typedef struct tagInf { char name[10]; unsigned int age; }Information; typedef struct tagPeo { Information inf; struct tagPeo *next; }People; int main() { Information *inf; inf=(Information *)malloc(sizeof(Information)); printf("Please enter some information (name age)\n"); scanf("%s %d",inf->name,&inf->age); printf("%s %d",inf->name,inf->age); free(inf); return 0; }
上面的程序构造了简单的链表。