I can't understand why this doesn't work,
but when i enable char *s=s1 and use s wherever s1 is used it returns the correct output.
char *mystrncat(char *s1,const char *s2, size_t n )
{
// char *s=s1;
while(*s1!='\0')
{
s1++;
}
while(n!=0 && (*s1++=*s2++)!='\0')
n--;
if(*s1!='\0')
*s1='\0';
return s1;
}