string concatenation with pointer

Write the function my_strncat(). The function has three parameters: a char * s1, a const char * s2, and an int max, which represents the maximum size of the s1 buffer. Append the characters in s2 to the end of s1. Make sure you have only one '\0' at the end of the combined characters. Don't go beyond the end of the buffer you are asked to copy to. The function returns a pointer to the first character in s1.

My code does seem to give the right output, but I think the way I declare it wasn't very good,
can someone help me with a better code.