现在的位置: 首页 > 综合 > 正文

链表的学习

2014年09月05日 ⁄ 综合 ⁄ 共 379字 ⁄ 字号 评论关闭
#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;
}

上面的程序构造了简单的链表。

 

抱歉!评论已关闭.