char * mystrcat(char *str1, char *str2)
{
if((str1==NULL)||(str2==NULL)) return NULL;
char *pt = str1;
while(*str1!='\0') str1++;
while(*str2!='\0') *str1++ = *str2++;
*str1 = '\0';
return pt;
}
int mystrcmp(const char * src, const char * dst )
{
int ret = 0 ;
while( ! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst)
++src, ++dst;
if ( ret < 0 )
ret = -1 ;
else if ( ret > 0 )
ret = 1 ;
return( ret );
}
int myStrlen(const char *str)
{
if(str==NULL) return 0;
int len = 0;
for(; *str++ != '\0'; )
{
len++;
}
return len;
}
char * mystrcpy (char * dst, char * src)
{
char * cp = dst;
while( *cp++ = *src++ )
;
return( dst );
}
#include
void conectstring(char str1[],char str2[],char str[])
{
int i,j;
for(i=0;str1[i]!='\0';i++)
str[i]=str1[i];
for(j=0;str2[j]!='\0';j++)
str[i+j]=str2[j];
str[i+j]='\0';
}
void main()
{
char s1[50],s2[50],s[50];
printf("input string1:");
gets(s1);
printf("input string2:");
gets(s2);
conectstring(s1,s2,s);
printf("the new string is %s\n",s);
}