I just wrote strcat( char*, char*) :)

#include<stdio.h>
char * strcat (char *,char *);
void main(void){
	char *s = "Pointer powers\n";
	char *t = " activate\n";
	
	char *z=strcat(s,t);

}
char * strcat(char *s, char *t){
	//return the concatenation of s and t
	char concatenation[255];
	int i=0;
	while (*s != '\0'){
		concatenation[i]=*s;
		*s++;
		i++;
	}
	while (*t != '\0'){
		concatenation[i]=*t;
		t++;
		i++;
	}
	concatenation[i]='\0';
	return concatenation;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s