#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#define MAXSIZE 100;
#define TURE 1
#define ERROR 0
typedef Elmetype int
typedef struct{
Elmetype *elme;
int length;
}Sqlist;
int initlist(Sqlist *L){
L->elme=(Elmetype *)malloc(MAXSIZE*sizeof(Elmetype));
if(!L->elme) return ERROR;
L->length=0;
return TURE;
}
int insertlist(Sqlist *L,int i,Elmetype e){
if(i<1||i>L->length+1) return ERROR;
if(L->elme+L->length-1>=L->MAXSIZE) return ERROR;
Elmetype *P,*q;
q=L->elme+i-1;
p=L->elme+L->length-1;
for(;p>=q;p--){
*(p+1)=*P;
}
*q=e;
++L->length;
return TURE;
}
int deletelist(Sqlist *L,int i){
if(i<1||i>L->length+1) return ERROR;
if(L->length==0) return ERROR;
Elmetype *P,*q;
q=L->elme+i-1;
p=L->elme+L->length-1;
for(;q<=p;q++){
*q=*(q+1);
}
q=L->elme+i-1;
free(q);
--L->length;
}
void displaylist(Sqlist L){
int i;
for(i=0;i<=MAXSIZE;i++){
printf("%d\t",L->elme[i]);
}
}
int main(void){
Sqlist *L;
L=(Elmetype *)malloc(MAXSIZE*sizeof(Elmetype));
Elmetype e;
int i;
initlist(L);
printf("Enter i:");
scanf("%d",&i);
while(i<1000){
printf("Enter e:");
scanf("%d",&e);
insertlist(L,i,e);
printf("Enter i:");
scanf("%d",&i);
}
displaylist(L);
printf("Enter i:");
scanf("%d",&i);
while(i<1000){
deletelist(L,i);
printf("Enter i:");
scanf("%d",&i);
}
displaylist(L);
return 0;
}错误在哪
请问你用的这个编程软件在哪下的能发个给我?
追答我用的是VC++ 6.0,你应该有的。
还有其他错误运行不了啊