Returning Arrays/Pointers from a function

Typically, you require the caller to pass in the result array.

void splitString( const char string[], int result[], int n) {
    //....
}

This is advantageous because the caller can allocate that memory wherever they want.

Leave a Comment