帮看一下我的C语言串操作,不知道为什么有11个warning1个error?

[复制链接]
查看11 | 回复2 | 2009-3-27 16:47:35 | 显示全部楼层 |阅读模式
#include
#include
#include
#defineNULL
0
#defineok
1
#defineerror 0
#defineMAXSIZE 100
typedef struct{

char*ch;

int length;
}HString;
void newline();
void HStrMenu();
void HStrAssign(HString *S,char *chars);
void OutputStr(HString *S);
int
StrLength(HString *S);
int
StrConpare(HString *S,HString *T);
main()
{ intx=0;

char y,chars[MAXSIZE];

HString *S,*T;

do

{clrscr();HStringMenu();

printf("Input the number: ");

scanf("%d",&x); newline();

switch(x)

{
case 1:
printf("\nPlease input the chars:\n");

gets(chars);
newline();

HStrAssign(S,chars);
break;

case 2:
OutputStr(S);
break;

case 3:
printf("\nThe length of the String is %d. \n",StrLength(S));

case 4:
if(StrConpare(S,T)>0)printf("\nS>T.\n");

if(StrConpare(S,T)==0)printf("\nS=T.\n");

if(StrConpare(S,T)T,返回>0。若S=T,返回=0。若S<T,返回<0。*/
{ int i=0;

for(i=0;(i<(*S).length)&&(i<(*T).length);++i)

{ if((*S).ch!=(*T).ch)return (*S).ch-(*T).ch;

else return (*S).ch-(*T).ch;

}
}
关于
void newline();
void HStrMenu();
两个函数申明很简单就是输出目录和清行

回复

使用道具 举报

千问 | 2009-3-27 16:47:35 | 显示全部楼层
if((!(*T).ch=(char* )malloc(i*sizeof(char)))) 。。。等号左边不能是表达式。void OutputStr(HString *S) /*输出串*/{ puts(S); }不能用put(s);clrscr();这2个函数的头文件没包含。HStringMenu();函数实现没写...
回复

使用道具 举报

千问 | 2009-3-27 16:47:35 | 显示全部楼层
路过,水平有限,解决不了你的问题。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行