Sorry, everything we suggested you do to fix it together and broke again! From the source code, make the following settings:
- Function signatures should be
char ***resultinstead char **result. - Array allocation should be
*result = malloc(...)instead result = malloc(...). - ,
component[componentLength] = '\0'; (*result)[numberOfComponents] = component; ( , char***). - , , :
strspl(..., &result); strspl(..., result);
, C/++... , :
, :
Address - Data - Description
0x99887760 - 0xbaadbeef - caller-result variable (uninitialized garbage)
: strspl(..., result);, (0xbaadbeef) strspl:
Address - Data - Description
0x99887750 - 0xbaadbeef - strspl-result variable (copy of uninitialized garbage)
...
0x99887760 - 0xbaadbeef - caller-result variable (uninitialized garbage)
, result = malloc(...) strspl-result, :
Address - Data - Description
0x99887750 - 0x01000100 - strspl-result variable (new array)
...
0x99887760 - 0xbaadbeef - caller-result variable (uninitialized garbage)
, .
: strspl(..., &result); :
Address - Data - Description
0x99887750 - 0x99887760 - strspl-result variable (pointer to the caller result)
...
0x99887760 - 0xbaadbeef - caller-result variable (uninitialized garbage)
, result = malloc(...), :
Address - Data - Description
0x99887750 - 0x01000100 - strspl-result variable (new array)
...
0x99887760 - 0xbaadbeef - caller-result variable (uninitialized garbage)
, , .
*result = malloc(...), :
Address - Data - Description
0x99887750 - 0x99887760 - strspl-result variable (pointer to the caller result)
...
0x99887760 - 0x01000100 - caller-result variable (new array)
, , malloc 'd.
, . , , ( char*** not char**).
, , !:-P