我用win tc 时编译时说:说明语法错误在Reverse中..请大家指点一下!thanks
#include "stdio.h"
#include "math.h"
struct NODE_TYPE
{
int Data;
struct NODE_TYPE *pNext;
};
struct LIST_TYPE
{
struct NODE_TYPE *pHead;
int Length,n,list[];
};
#include "lab3h.h"
main()
{
void Reverse();
/*下面填写主程序*/
void Initiate();
int Length();
int *GetAt();
int GetIndex();
int Insert();
int Delete();
void Reverse();
struct LIST_TYPE list;
struct NODE_TYPE id,data1,data2 ;
int i,j,lg,x,data;
/* ①创建一个空表[Initiate( )]; */
printf("Initiate List!\n");
Initiate(&list);
/* ②提示用户输入"线性表长度"; */
printf("The Length of List is:");
scanf("%d",&lg);
/* ③根据用户输入的"线性表长度",逐一提示用户输入"线性表中的各个元素",完成线性表的构造[Insert()]; */
for(i=1;i<=lg;i++)
{
printf("Enter the %dth data:",i);
scanf("%d",&x);
Insert(&list,i,x);
}
/* ④通过调用子程序Length() 打印输出当前线性表的长度; */
lg=Length(&list);
printf("The length of List is :\t%d!\n",lg);
/* ⑤自行编写子程序PrintList( ) 打印输出当前线性表的所有元素;*/
printf("The List is:\n");
PrintList(&list,x);
/* ⑥提示用户输入要查找的元素数值,通过调用子程序*Find( ) 找到符合要求的第一个元素,并打印输出该元素的数值; */
/* *GetPrior( ) 打印输出该元素的前驱元素值; */
/* *GetNext( ) 打印输出该元素的后继元素值;
*/
printf("Enter the data to be searched:");
scanf("%d",&data);
id=*Find(&list,data);
printf("found of data %d is :\t %d \n",data,id.Data);
data1=*GetPrior(&list,data);
printf("Prior of data %d is :\t %d \n",data,data1);
data2=*GetNext(&list,data);
printf("Next of data %d is :\t %d \n",data,data2);
/* ⑦通过调用子程序Insert( ) 在当前线性表的表头和表尾各插入一个元素0 ,打印输出插入后的线性表[PrintList( )];*/
printf("Insert data 0 into Head and End of List!\n");
Insert(&list,1,0);
Insert(&list,lg+2,0);
printf("The List after insert operation is:\n");
PrintList(&list);
/* ⑧通过调用子程序Delete( ) 删除⑦中插入的各个元素,打印输出删除后的线性表[PrintList( )]; */
printf("Delete the data Inserted!\n");
Delete(&list,1);
Delete(&list,lg+1);
printf("The List after Insert operation is:\n");
PrintList(&list);
/* ⑨调用自行编写的链式结构下线性表的逆转子程序Reverse( ),打印输出逆转后的线性表[PrintList( )]。*/
printf("the list is:\n");
Reverse(list) ;
printf("the operate:\n");
printflist(&list);
getch();
}
void Reverse(list)
struct LIST_TYPE *list
{
int Length();
struct NODE_TYPE *pNode,*pNode1
if(Length(list)>=2)
{pNode=list->pHead;
for (i=1:i<=floor(Lengh(list)/2);i++)
{pNode1=pNode;
for(j=1;j<=(lengh(list)-2*i+1);i++)
{pNode1=pNode->pnext;
pNode->Data=pNode->Data^pNode1->Data ;
pNode1->Data=pNode1->Data^pNode->Data ;
pNode->Data=pNode->Data^pNode1->Data ;}
pNode=pNode->pNext ;
}
}
}