为毛在while那个地方老是出错?
#include<stdio.h>#include<stdlib.h>
#define MaxSize 20
typedef struct
{
char data;
int length;
}SqString;
void InitString(SqString *s)
{
s=(SqString *)malloc(MaxSize*sizeof(SqString));
if(!s)
{
exit(0);
}
s->length=0;
}
void createString(SqString *s)
{
char ch;
printf("请输入字符串:\n");
whlie((ch=getchar())!='\n')
{
s->data=ch;
s->length++;
}
getchar();
s->data='\0';
}
main()
{
SqString s;
int n;
InitString(&s);
createString(&s);
} while写错了 亲,何不自己找相关代码参考下?!{:7_139:} 那请问老兄代码去哪里找?:big :smile
页:
[1]