I was given the following struct definitions for an assignment revolving around queues and stacks:
struct entry
{
bool operation;
char op;
int num;
};
struct node
{
bool operation;
char op;
int num;
entry * next;
};
The assignment is easy enough, but I’m not sure how to implement these structures into a queue or a stack. I thought that if you wanted to create a linked list, then, you used only one structure. Is there any way to use this setup? Could it be a typo?
Something is off. Your node can point to a “next” element but this “next” element can’t point to anything else.
I suspect it should actually look like this: