![]() |
![]() |
![]() |
![]() |
![]() |
|
Some programmers believe you can be even clearer about purpose by using
C's typedef mechanism, whereby you can create a synonym for a
type-defining symbol. Suppose, for example, that you include the following
typedef declaration in your program:
typedef double Price_per_share_traded;
Henceforth, you can use the symbol Price_per_share_traded in place
of double, as in the following variable declaration:
*-- Type specification | | *-- Variable name | | v v Price_per_share_traded price;
The substitution of Price_per_share_traded for
double makes no difference to the C compiler, because the
C compiler takes both to specify only that price is a
floating-point number. For you, however, the substitution makes
it absolutely clear for what the value of price is to be
used.