char *copy(char *dest, const char *src, int capacity) {
    dest = malloc(sizeof(char) * capacity);
    memset(dest, '\0', capacity);
    dest[capacity] = '\0';
    for(int i = 0; i < (capacity - 1); i++){
        dest[i] = src[i];
    }
    return dest;
}
char *copy copies the string in *src to *dest, but it makes sure that *dest ends with a '\0'. capacity is supposed to be the maximum amount of characters copied to *dest, including the '\0' at the end.
