Change the struct declaration so that it includes a tag.
Now write a function that prints out the data in a Bulb
.
Declare and initialize two Bulb
s in main and print
out their data.
Write printBulb()
to print out the values
in its Bulb
parameter b
.
ANSI C is always call by value so when
printBulb()
is active its parameter b
will have a complete copy of a struct variable.
#include <stdio.h> /* declare the type struct Bulb (Notice the tag) */ struct Bulb { int watts; int lumens; }; /* function to print a Bulb */ void printBulb( struct Bulb b ) { ?????? } int main() { /* declare and initialize two Bulbs */ /* print values of both Bulbs */ return 0; }