15 January 2012

Returning array from function in C

I've here very intersting discussion about the best and common ways to return an array from a function..

Some solutions to use output parameter and copy the value of the array into the value of this output parameter array.
Other solution to pass an array and use it inside the function.

Others to allocate the array inside the function and return refrence to it, but the caller have to free it once done.

Others to return a struct contains this pointer...

Please enjoy; stackoverflow.com/questions/8865982/return-array-from-function-in-c

No comments: