帮我看下这个程序吧
怎么运行不了啊
是数据结构中关于字符串连接的
#include<string.h>
#include<stdio.h>
#define MAXSIZE 100
typedef struct{
char str[MAXSIZE];
int length;
}seqsring;
seqstring*strconcat(seqstringS1,seqstringS2)
{
int i;
seqstring*r;
if(S1.length+S2.length>MAXSIZE-1)
{printf("cannot concate");
return(NULL);}
else
{
r=(seqstring*)malloc(sizeof(seqstring));
for(i=0;i<S1.length;i++)r->str[i]=S1.str[i];
for(i=0;i<S2.length;i++)r->str[i]=S2.str[i];
r->length=S1.length+S2.length;
r->str[r->length]='\ 0';
}
return (r);
}
void main()
{
seqstring S1,S2;
S1.str[]="abcdefg"; S2.str[]="123456";
S1.length=strlen(S1.str[]);
S2.length=strlen(S2.str[]);
strconcat(S1,S2);
printf("\n\n字符串为:s%",r->str[]);
getch();
}
[求助]数据结构中关于字符串连接的一个程序