 <p>All methods of which I am aware to return an array from a function have weaknesses and strengths.</p> <p>Wrapping in a struc avoids the overhead of allocating and freeing memory, as well as avoids remembering to free. You have those problems on any solution that uses malloc, calloc, and realloc. On the other hand, wrapping in a struct requires knowing the maximum possible size of the array, and is decidedly wasteful of memory and execution time for large arrays (for example, loading a file into memory and passing the file contents around from function to function by copying).</p>