Friday, October 30, 2009

Creating your own strcat()

Creating your own strcat()


void main()
{
char source[]="Folks!";
char target[30]="Hello";

scat(target,source);
printf("\nSource string = %s",source);
printf("\nTarget string = %s",target);
}

scat(char *m,char *n)
{
char *p;
p=m;
while(*n!='\0')
{
if(*m=='\0'||m>p+6)
{
*m=*n;
n++;
}

m++;
}

*m='\0';
}

No comments:

Post a Comment