// program for 'a=a+b', where 'a' is an string and 'b' is also a string
// output will be // 'a'='bombay ' //
// 'b'= 'goa' //
// "bombaygoa" //
#include(stdio.h)
void scat(char *,char *);
void main()
{
char a[21],b[21];
printf("Enter a string");
scanf("%s",a);
printf("Enter a string");
scanf("%s",b);
scat(a,b); // call
printf("%s",a);
} // end
void scat(char *p,char *q)
{ while(*p!='\0')
{ p++;
}
while(*q!='\0')
{ *p = *q;
p++;
q++;
}
*p='\0';
}
0 comments:
Post a Comment