大一队列模拟栈作业,求大神解答

下面是我写的代码,能运行但是你输入几个A就出来几个ERROR FULL

只有这个结果我也不知道为什么,求大神解答

 

 

 

#include <stdio.h>
#include <stdlib.h>
 
typedef struct Node
{
    int data;
    struct Node *next;
    int top;
}*Qnode;
 
 
Qnode CreateList()
{
    Qnode L;
    L=(Qnode)malloc(sizeof(struct Node));    
    L->next=NULL;
    L->top=0;
    return L; 
}
 
Qnode InsertList(Qnode L,int e,int n)
{
    if(L->top=n)
    {
        printf("ERROR FULL");
    }
    else
    {
        Qnode p;
        p=(Qnode)malloc(sizeof(struct Node));
        p->next=L->next;
        L->next=p;
        p->data=e;
        L->top++;
    }
    return     L;
}
 
Qnode PopList(Qnode L)
{
    if(L->top=0)
    {
        printf("ERROR EMPTY");
    }
    else
    {
        Qnode q;    
        q=(Qnode)malloc(sizeof(struct Node));    
        q=L->next;
        printf("%d\n",q->data);
        L->next=q->next;
        L->top--; 
    }
    return L;
}
 
int main()
{
    Qnode L; 
    L=CreateList();
    char m;
    int n,e;
    scanf("%d",&n);
    scanf("%c",&m);
    if(m=='T')
    {
        exit(0);
    }
    
    while(m!='T')
    {
        if(m=='A')
        {
            scanf("%d",&e);
            InsertList(L,e,n);
            
        }
        else if(m=='D')
        {
            PopList(L);
        }
        scanf("%c",&m);
    }
    return 0;
}

 if(L->top=n),这是赋值表达式,,不是比较表达式

而且,

1. 这个是队列啊,为什么用insert,插入?

2. 插入到初始节点后面,pop的时候还从初始节点后面取?这还是先入先出吗。。

C和C++完整教程:https://blog.csdn.net/it_xiangqiang/category_10581430.html