![]() |
![]() |
![]() |
![]() |
![]() |
|
You may also want to use readers to provide access
to virtual structure variables that exist only in the sense that their
values can be computed from structure variables that do exist. For
example, you can create a read_total_cost function, which seems to
read the contents of a total_cost structure variable, but which
actually works with the price and number structure variables:
double read_total_cost (struct trade *tptr) {
return tptr -> price * tptr -> number;
}