首先,我们看一下MSDN中对它的定义,函数参数,返回值
strcat
(定义)Append a string.
(函数参数)char *strcat( char *strDestination, const char *strSource );
(返回值)Each of these functions returns the destination string (strDestination). No return value is reserved to indicate an error.
接下来看一下代码实现
#include<stdio.h>
#include<assert.h>
#include<windows.h>
char* my_strcut(char* p,const char* q)
{
assert(p != NULL);
assert(q != NULL);
char* str = p;
while(*p)
{
p++;
}
while (*p++ = *q++)
{
;
}
return str;
}
int main()
{
char arr[20] = "hello ";
my_strcut(arr, "bit");
printf("%s",arr);
system("pause");
return 0;
}