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.
More Related Contents:
- Changing array inside function in C
- When is an array name or a function name ‘converted’ into a pointer ? (in C)
- How can I return a character array from a function in C?
- C pointer notation compared to array notation: When passing to function
- C array pointer increment
- Is an array name a pointer?
- Returning an array using C
- How do I modify a pointer that has been passed into a function in C?
- C pointer to array/array of pointers disambiguation
- C Programming: malloc() inside another function
- Difference between passing array and array pointer into function in C
- Create a pointer to two-dimensional array
- Exceptions to array decaying into a pointer?
- Why do arrays in C decay to pointers?
- Pointer address in a C multidimensional array
- Efficiency: arrays vs pointers
- Parameter Passing in C – Pointers, Addresses, Aliases
- Pass a two dimensional array to a function of constant parameter
- What’s a modern term for “array/pointer equivalence”?
- Is it possible to allocate array inside function and return it using reference?
- Literal string initializer for a character array
- Doesn’t a 2D array decay to pointer to pointer
- Are a, &a, *a, a[0], &a[0] and &a[0][0] identical pointers?
- What’s the difference between array and &array?
- Array of size 0 at the end of struct [duplicate]
- Pointer expressions: **ptr++, *++*ptr and ++**ptr use
- Reliably determine the number of elements in an array
- Difference between dereferencing pointer and accessing array elements
- Difference between pointer to pointer and pointer to array?
- What is the function of an asterisk before a function name?