帮忙看看是哪错了
下面是代码及错误提示,帮忙改改,我实在是没辙了。看不懂错误提示。
--------------------Configuration: feifei - Win32 Debug--------------------
Compiling...
指针连接字符串.c
E:\三级\my project\feifei\指针连接字符串.c(9) : warning C4013: 'strlen' undefined; assuming extern returning int
E:\三级\my project\feifei\指针连接字符串.c(16) : error C2143: syntax error : missing ';' before 'type'
E:\三级\my project\feifei\指针连接字符串.c(19) : error C2143: syntax error : missing ';' before 'type'
E:\三级\my project\feifei\指针连接字符串.c(20) : error C2143: syntax error : missing ';' before 'type'
E:\三级\my project\feifei\指针连接字符串.c(23) : error C2065: 'ch' : undeclared identifier
E:\三级\my project\feifei\指针连接字符串.c(23) : error C2065: 's1' : undeclared identifier
E:\三级\my project\feifei\指针连接字符串.c(23) : error C2100: illegal indirection
E:\三级\my project\feifei\指针连接字符串.c(28) : error C2065: 's2' : undeclared identifier
E:\三级\my project\feifei\指针连接字符串.c(28) : error C2100: illegal indirection
E:\三级\my project\feifei\指针连接字符串.c(29) : error C2100: illegal indirection
E:\三级\my project\feifei\指针连接字符串.c(29) : error C2106: '=' : left operand must be l-value
E:\三级\my project\feifei\指针连接字符串.c(31) : error C2065: 'dest' : undeclared identifier
E:\三级\my project\feifei\指针连接字符串.c(33) : error C2059: syntax error : '}'
执行 cl.exe 时出错.
feifei.exe - 1 error(s), 0 warning(s)
#include<stdio.h>
#include<stdlib.h>
char*strCat(register char*dest,register const char*src);
int main(void)
{
char strDest[161]="you are";
char strName[81];
puts("please enter your name:");
while((strlen(strDest)<80) && strlen(gets(strName)))
{
strCat(strDest,strName);
printf("%s\n",strDest);
system("pause");
return 0;
}
char*strCat(register char*dest,register const char*src)
{
register char*s1=dest;
register const char*s2=src;
register char ch;
do
{
ch=*s1++;
}while(ch!='\0');
s1-=2;
do
{
ch=*s2++;
*++s1=ch;
}while(ch!='\0');
return dest;
}
}