Modify the following program
(the answer to puzzle T03) so that it uses
a typedef
and uses the type name where needed.
#include <stdio.h>
struct Bulb
{
int watts;
int lumens;
};
/* function to print a Bulb */
void printBulb( struct Bulb b )
{
printf("watts = %d\tlumens = %d\n", b.watts, b.lumens );
}
int main()
{
/* declare and initialize two Bulbs */
struct Bulb bulbA, bulbB;
bulbA.watts = 100; bulbA.lumens = 1710;
bulbB.watts = 60; bulbB.lumens = 1065;
/* print values of both Bulbs */
printBulb( bulbA );
printBulb( bulbB );
return 0;
}
The type name can also be used as the type of a function parameter.