There's nothing wrong with it, except that you might forget to free. Probably the most failure-tolerant way is the suggestion from whiteflags, to make a struct. This has the advantage that you can name what the parameters are for. For example, say you have function foo that returns the sum and the product. Then you could write the function like this