大约 3 分钟
数据结构 - 栈
栈
数据结构
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
// 栈可以用数组或链表来存取数据,数组更优,因此这里用数组实现
typedef int SDataType;
typedef struct Stack {
SDataType *arr;
int top; // 栈顶
int capacity; // 容量
} Stack;
大约 1 分钟