I have a rough concept of being able to return a variable length array of pointers (allocated by calloc) with the data (also allocated by calloc) where the pointer list ends with NULL.
So a <do .. while> could traverse the data and stop when it hits null, just like a string.
But I'm not 100% on how to dealloc the array of data (yet), dealloc on the array of pointers (+1 with last member) = NULL seems easy enough.
I guess maybe I could calloc each member of the array of data and use the pointer array to pass the right memory address to free. Then write a function to possible conveniently wrap this using type (void *) and passing size_t. Then possibly wrapping the entire calloc bit into a similar type void function to easy the actual return of data.
This seems obvious enough that I feel it has been done before. This is just a morph of the concept of returning a malloc allocated null-terminated string.
The reason I want to do this is to be able to possibly return a set of matching points for geometry functions, where the number of points (vertices) maybe be anything from 0 matches to N matches.
(Will have to write and test this, but I'm rather sure I can make this work. I do not like the idea I cannot return an array of unknown size in C.)
/End rant ...