这程序错在哪里
#define MAXSIZE 100
typedef struct{
char str[MAXSIZE];
int length;
}seqstring;
void strinsert(seqstring *S,int i,seqstring T)
{
int k;
if(i<1||i>S->length+1||S->length+T.length>MAXSIZE-1)
printf("cannot insert\n");
else
{
for(k=S->length-1;k>=i-1;k--)
S->str[T.length+k]=S->str[k];
for(k=0;k<T.length;k++)
S->str[i+k-1]=T.str[k];
S->length=S->length+T.length;
S->str[S->length]='\0';
}
}
main()
{ seqstring *S,T;
gets(*S);
gets(T);
strinsert(S, 3, T);
printf("%s",S);
getch();
}