报错c(179) :error C2275:'LNODE' :illegal use of this type as an expression等,哪里错了,怎么改呢#include #include"stdlib.h"typedef struct node{int data;struct node *next;}LNODE;//函数声明void printmenu();LNODE* InitList();void InsertList(LNODE *p,int pos,int num);void deleteList(LNODE *p,int pos);void turnAroundList(LNODE *p);int findList(LNODE *p,int num);int sumList(LNODE *p);void unionList(LNODE *p,LNODE*q);void printList( LNODE *p);void printmenu(){printf("");}//定
报错c(179) :error C2275:'LNODE' :illegal use of this type as an expression等,哪里错了,怎么改呢
#include
#include"stdlib.h"
typedef struct node
{
int data;
struct node *next;
}LNODE;
//函数声明
void printmenu();
LNODE* InitList();
void InsertList(LNODE *p,int pos,int num);
void deleteList(LNODE *p,int pos);
void turnAroundList(LNODE *p);
int findList(LNODE *p,int num);
int sumList(LNODE *p);
void unionList(LNODE *p,LNODE*q);
void printList( LNODE *p);
void printmenu()
{
printf("");
}
//定义一个单链表指针并初始化
LNODE* InitList()
{
LNODE *p=0;
p=(typedef LNODE *)malloc(sizeof(LNODE));
p->next=0;
return p;
}
//插入用户输入的数据
void InsertList(LNODE *p,int pos,int num)
{
int j=0;
LNODE *q;
while((p->next!=0) && (jnext;
j++;
}
if(j==pos-1)
{
q=(typedef LNODE *)malloc(sizeof(LNODE));
q->next=p->next;
p->next=q;
q->data=num;
}
else
{
printf("无法插入");
}
}
//删除第pos个数据
void deleteList(LNODE *p,int pos)
{
int j=0;
LNODE *q;
while(p->next!=0 && jnext;
j++;
}
q=p->next;
if(j==pos-1)
{
p->next=q->next;
q->next=q;
}
}
//反转链表
void turnAroundList(LNODE *p)
{
LNODE *q,*r;
q=p->next;
p->next=0;
while(q->next!=0)
{
r=q->next;
q->next=p;
p=q;
q=r;
}
}
//查找
int findList(LNODE *p,int num)
{
int a;
while(p->next!=0)
{
if(num==p->data)
{
a=1;
break;
}
else
{
p=p->next;
a=-1;
}
}
return a;
}
//求共有n个节点
int sumList(LNODE *p)
{
int sum=1;
int i;
while(p->next!=0)
{
i=i+1;
}
return sum;
}
//集合求并
void unionList(LNODE *p,LNODE*q)
{
int num,n;
p=p->next;
n=sumList(p);
while(q->next!=0)
{
num=p->data;
p=p->next;
if (findList(p,num)next!=0)
{
printf("%d ",p->data);
p=p->next;
}
printf("\n");
}
main()
{
int a,b,pos,num;
printmenu();
LNODE *phead=0;
LNODE *qhead=0;
printf("enter your choice");
scanf("%d",&a);
while (a>0 && a0 && b