Hi,
I am trying to write a program to concat two strings. Its a simple one, but i am unable to indentify the error. Please help.
#include <stdio.h>
int main()
{
char s1[80],s2[80],s3[80];
int len1,len2;
printf("Enter the first string\n");
scanf("%s",&s1);
printf("\nEnter the second string to be appended to the first\n");
scanf("%s",&s2);
len1=strlen(s1);
len2=strlen(s2);
xstrcmp(s1,s2,len1,len2);
}
xstrcmp(char *s1,char *s2,int len1,int len2)
{
int i;
s1=s1+len1;
for(i=0;i<=len2;i++)
{
*s1=*s2;
s1++;
s2++;
}
printf("\nThe concatenated string is %s",s1);
getch();
}



LinkBack URL
About LinkBacks



.
!
. I am trying to read books but none of them give information in detail. Is there any book which goes into details(depth).
Thanx Shade. By the way i just misspelled strcat as strcmp.