Comment by hibbelig

5 years ago

An output argument is when you pass an argument to a function, the function makes changes, and after returning you examine the argument you passed to see what happened.

Example: the caller could pass an empty list, and the method adds items to the list.

Why not return the list? Well, maybe the method computes more things than just the list.

> Why not return the list? Well, maybe the method computes more things than just the list.

Or in C you want to allocate the list yourself in a particular way and the method should not concern with doing the allocation itself. And the return value is usually the error status/code since C doesn't have exceptions.