#include <stdio.h>
#include <string.h>

char *strreplace(char *str,const char *from,const char *to)
{
	char *p=str;
	while( p=strstr(p,from) )
	{
		memmove(p+strlen(to),p+strlen(from),strlen(p+strlen(from))+1);
		memcpy(p,to,strlen(to));
		p+=strlen(to);
	}
	return str;
}

int main()
{
	char x[64000]="hallo ende";
	puts(strreplace(x,"en","enn"));
	return 0;
}
