Home Segments Index Top Previous Next

329: Mainline

You normally should not pass information into or out of a function using a pointer parameter. Occasionally, however, the pointer-parameter mechanism for passing information into or out of a function is extremely useful.

First, you already know that it can be time consuming to copy a structure object when a function is called. It also can be time consuming to copy a structure object when a function returns. The pointer-parameter mechanism for passing information avoids both copying operations.

Second, the pointer-parameter mechanism for passing information out of a function allows you to get more than one value out of the function. You can get one value out for every pointer parameter, because each supplies access to a memory chunk reserved outside the function.