/*A program to concatinate or to add two strings...*/
//A program to make strcat () function*/
#include<stdio.h>
#include<string.h>
int xstrcat(char*,char*);
int len;
int main()
{
//int len2;
char source[]="KAMBOJ";
char target[30]="ANU";
//len1=strlen(source);
len=strlen(target);//count no. of characters of target to which source is to be attached
xstrcat(source,target);//send address of source & destination in fun_c call
printf("target=%s",target);
printf("\nsource=%s",source);
return 0;
}
int xstrcat(char *s,char *t)
{
for(;*(t+len)=='\0';)//for(;1;)
{
//s=s+4;
*(t+len)=*s;//base address of target+length of characters of target will get this string to end..where base address of source is started to put
t++;//every time ++menting base address of target so that unitll full source characters attached it may come to end ..so that come to end ..& compaired in loop...to make condition true ...& to come out of loop
s++;//++ment source string address so that all the characters of source string should attached to target
char name[]={"ANUBAL\0"};//all the loops are acting fine but this loop is not capable of printing L at end of string instead of that printing like null....may u tell me why?