|
| |
Typedef: defining a type
typedef <type> <identifier> [ <size>
];
- typedef defines a new type for use in the program. For example:
- typedef float prices [20];
- defines "prices" to be a new type consisting of an
array of 20 float numbers.
- notice that "prices" is not an array, it is just a
type. It can be used to create an array later on. For example:
- prices pricelist;
- this declares a variable of type prices; i.e. pricelist is an
array of 20 float numbers.
- another possibility:
- prices catalog [5];
- in this case, catalog is an array of 5 elements; each one is an
array of 20 floats.
|