Home Segments Index Top Previous Next

316: Mainline

It is important to know that you can specify that a parameter is to be a pointer parameter, rather than an ordinary parameter. Then, as you soon see, you can arrange for your pointer parameter to point to an appropriate object through the parameter assignment process that occurs when a function is called.

Just as an asterisk transforms an ordinary variable into a pointer variable, an asterisk transforms an ordinary parameter into a pointer parameter. In the following illustration, you see that trade_price function's previous parameter, t, has been converted into a pointer parameter, tptr:

double trade_price (struct trade *tptr) {...} 

Because of the asterisk, the value of tptr must be the address of trade structure, rather than a trade structure.