C++ 对象编程:玩转链表

玩转链表

struct student {
    int num;
    float score;
    student *next;
};

// 用 STU 代替 struct student,代码更简洁
using STU = struct student;

STU {
    int num;
    float score;
    STU *next;
};

链表节点的小秘密

每个节点包含:

* 数据 (比如学生的学号和分数)

* 指向下一个节点的指针,将所有节点串联起来

ppt 文件大小:8.33MB