Concat
concat.c
#include <stdio.h>
char *concat(const char *, const char *);
int main(){
const char *p, *q;
p = "Hello ";
q = "World";
printf("%s", concat(p, q));
return(0);
}
char *concat(const char *s, const char *t){
void *malloc();
char *r, *rstart;
r = rstart = (char *)malloc(sizeof((int)s + t));
for(;*s != 0; s++, r++)
*r = *s;
}
OUTPUT:
Hello World