交换表中的数据,发现6个错误运行不了
#include <stdio.h>#include <stdlib.h>
#define MASIZE 100;
typedef int Elemtype;
typedef struct {
Elemtype data;
int length;}Sqlist;/*建立数据类型。*/
void Reserve_Sqlist(Sqlist *L)
{
int k,n,i,j;
n=L->length;
i=0;
j=n-1;
if(i>=j) return;
while(i<j)
{
k=L->data[i];//显示错误
L->data[i]=L->data[j];//显示错误
L->data[j]=k;//显示错误
i++;j--;
}
}
void Creat_Sqlist(Sqlist *L,int n)
{
int i;
L->length=n;
i=0;
printf("input the L data:");
while(i<n)
{
scanf("%d",&L->data[i]);//显示错误
i++;
}
}
void Print_Sqlist(Sqlist *L)
{
int n,i;
n=L->length;
i=0;
while(i<n)
{
printf("%d ",L->data[i]);//显示错误
i++;
}
}
int main()
{
Sqlist L;
int n;
printf("put into n:");
scanf("%d",&n);
Creat_Sqlist(&L,n);
Reserve_Sqlist(&L);
Print_Sqlist(&L);
}