哪里错了,求大神指教!!
#include<stdio.h>#include<stdlib.h>
#include<string.h>
#define OK 1
#define OVERFLOW -2
#define LIST_INIT_SIZE 10
typedef int status;
typedef int ElemType;
typedef struct {
ElemType *elem;
int length;
int listsize;
}SqList;
status InitList_Sq(SqList *L)
{
(*L).elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType ));
if(!((*L).elem))
return OVERFLOW;
(*L).length=0;
(*L).listsize=LIST_INIT_SIZE;
return OK;
}
status Rabbit(SqList*L)
{
int i,current=0;
for(i=0;i<LIST_INIT_SIZE;i++)
(*L).elem[i]=1;
(*L).elem[LIST_INIT_SIZE-1]=0;
(*L).elem[0]=0;
for(i=2;i<=1000;i++)
{
current=(current+i)%LIST_INIT_SIZE;
(*L).elem[current]=0;
}
printf("\n兔子可能藏在如下的洞中:");
for(i=0;i<LIST_INIT_SIZE;i++)
if((*L).elem[i]==1)
printf(" \n此洞是第%d号洞 ",i+1);
return OK;
}
void main()
{
SqList *L;
InitList_Sq(L);
Rabbit(L);
getchar();
}