![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Suppose, for example, that you decide to write a function that constructs trades, similar to the one defined in Segment 385:
/* Define trade structure */ struct trade { double price; int number; }; /* Define constructor for trade structures */ struct trade* construct_trade (double price, int number) { struct trade *tptr; tptr = (struct trade*) malloc (sizeof (struct trade)); tptr -> price = price; tptr -> number = number; return tptr; }
In contrast, you want the new version of construct_trade
to
be able to handle the following cases: