pzu*_*raq 1 c queue stack struct structure
我得到了以下结构定义,用于围绕队列和堆栈的分配:
struct entry
{
bool operation;
char op;
int num;
};
struct node
{
bool operation;
char op;
int num;
entry * next;
};
Run Code Online (Sandbox Code Playgroud)
赋值很简单,但我不确定如何将这些结构实现到队列或堆栈中.我想如果你想创建一个链表,那么你只使用了一个结构.有没有办法使用这个设置?这可能是一个错字吗?
有点不对劲.您的节点可以指向"下一个"元素,但此"下一个"元素不能指向其他任何元素.
我怀疑它应该看起来像这样:
struct entry {
bool operation;
char op;
int num;
};
struct node {
struct entry *entry;
struct node *next;
};
Run Code Online (Sandbox Code Playgroud)