basics · beginner · ~15 min

Copy a string

Copy bytes until and including the NUL.

Challenge

Implement void str_copy(char *dst, const char *src) copying src into dst including the terminating NUL. dst is large enough.

Starter code

void str_copy(char *dst, const char *src) {
    /* TODO */
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.