Home Segments Index Top Previous Next

300: Mainline

Recall that C ordinarily reserves a memory chunk for each parameter whenever a function is called. Evaluated arguments are copied into those reserved memory chunks.

For example, when the trade_price function—as defined, for example, in Segment 294—is called, a trade object from the trades array is copied into the memory chunk reserved for trade_price's t parameter. The following illustrates the first call to trade_price:

  *-- Memory allocated for trade array 
  | 
  v 
 ----------------------------------------- 
      0            1            2              <-- Index 
*------------*------------*------------*-- 
|  trade     |  trade     |  trade     | 
|  object    |  object    |  object    | 
*------------*------------*------------*--- 
 ------------ 
      | 
      | 
      |           *-- Memory allocated for trade parameter 
      |           | 
      |           v 
      |          ------------ 
      |         *------------* 
      *-------> |  Copied    | 
                |  object    | 
                *------------*