←back to thread

78 points p2detar | 1 comments | | HN request time: 0.232s | source
1. bvrmn ◴[] No.46215442[source]
It's funny. One can't simply write a correct C code. Even after years of practice.

    void strclone(const char* str, char** outCpy)
    {
        size_t len = strlen(s) + 1;
        *outCpy = malloc(len);
        memcpy(outCpy, str, len); // wrong dest address 
    }
I don't like double pointer parameters because of it.