typedef doube Currency;
typedef does not create a new type. For instance the types double and Currency would be interchangeable.
Type definitions make the code easier to read. They can also be used to writing more portable code. The type int is on some machines only 16 bits long, for instance. If the program when moved to this machine needed to operate with large sums, only the typedefinition needs to be changed. All the gazillion points in the code using the alias would remain intact.
Reference: cprogramming, wikipedia, mmbase
No comments:
Post a Comment