还有就是下面程序中exit(0)出错?
#include<stdio.h>
#define maxsize 100
typedef struct {
int data[maxsize];
int length;
}sqlist;
int delet(sqlist *L)
{
int min,j,minvalue;
if(L->length==0){
printf(\"error: the linear list is empty!\\n\");
exit(0);
}
else{
min= 0;
for(j=1;j<=L->length-1;j++)
if(L->data[min]>L->data[j])min=j;
minvalue=L->data[min];
L->data[min]=L->data[L->length-1];
L->length--;
return minvalue;
}
}
main()
{
int a[]={2,1,-1,3,4,5,6},length=7,j;
sqlist L;
for(j=0;j<length;j++)
L.data[j]=a[j];
L.length=length;
printf(\"%d\",delet(&L));
} |