
Implement gm_strncpy, your own strncpy, which copies at most n bytes from src into dst, padding the rest of dst with \0 when src is shorter than n, and writing no terminator at all when src is n bytes or longer.
gm_strncpy(dst, "git", 8) // dst pre-filled with 10 '#', dump 10 bytesExpected result
git.....##For your own tracking. Tests grade your code.
gm_strncpy(dst, "rebase", 6) // src length == n: copied, no terminatorExpected result
rebase####gm_strncpy(dst, "docker", 4) // src longer than n: truncated, no terminatorExpected result
dock######Expected files
strncpy.cAllowed functions
None. Write every helper yourself.
Allowed headers
Standard C library
Implements the contract of a function from the standard C library.

v0.40: Create exercises. Challenge the community.
Meet Studio →Implement gm_strncpy, your own strncpy, which copies at most n bytes from src into dst, padding the rest of dst with \0 when src is shorter than n, and writing no terminator at all when src is n bytes or longer.
gm_strncpy(dst, "git", 8) // dst pre-filled with 10 '#', dump 10 bytesExpected result
git.....##For your own tracking. Tests grade your code.
gm_strncpy(dst, "rebase", 6) // src length == n: copied, no terminatorExpected result
rebase####gm_strncpy(dst, "docker", 4) // src longer than n: truncated, no terminatorExpected result
dock######Expected files
strncpy.cAllowed functions
None. Write every helper yourself.
Allowed headers
Standard C library
Implements the contract of a function from the standard C library.

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.