为什么总是输出一串乱码数字

#include
#include
const int m;
typedef struct LNode
{
int num,pwd;
struct LNode next;
}LNode,*LinkList;
struct LNode *head,*p,*pt;
int creatLinkList(int n)
{
int i;
head=(struct LNoode
)malloc(sizeof(struct LNode));
if(!head) return 0;
p=head;
for(i=1;i<=n;i++)
{
pt=(struct LNode*)malloc(sizeof(struct LNode));
if(!pt) return 0;
p->next=pt;
p=pt;
}
p->next=head;
pt=head;
return head;
}
int enterPwd(int n)
{
int i;
printf("\n 请输入密码:\n");
scanf("%d",&m);
for(i=1;i {
pt->num=i;
pt->pwd=m;
pt=pt->next;
}
pt=p;
return 0;
}
void Dele(LinkList a)
{

printf("%d\n",a->next->num);
a->next=a->next->next;

}

int outlist(n)
{
int i;
int s=0;
while(s {for (i=1;i {
p=p->next;
}
Dele(p);
s++;
}
}
int main()
{
int n;
printf("请输入人数:");
scanf("%d",&n);
creatLinkList(n);
enterPwd(n);
printf("\n出队的人依次是:\n");
outlist(n);
return 0;
}

输入人数3,密码2,输出的结果为什么总是2和两个类似乱码的6位数

检查你对指针内容写入的地方,是不是把字符数组的结束符给充掉了

我都怀疑你的代码能不能编译

 int creatLinkList(int n)
{
    int i;
    head = (struct LNode*)malloc(sizeof(struct LNode));
    if (!head) return 0;
    p = head;
    for (i = 1; i <= n; i++)
    {
        pt = (struct LNode*)malloc(sizeof(struct LNode));
        if (!pt) return 0;
        p->next = pt;
        p = pt;
    }
    p->next = head;
    pt = head;
    return head;
}

这里LNode拼写错了,返回值类型也不对。
后面代码就不看了。

如果你的代码能编译,说明你的程序中还有一个叫LNoode的结构体或者类,那么根本没用到LNode,你的代码也不全。

代码有些凌乱啊,没有注释吗?