Puzzle T3


Call by Value

picture of a struct

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 Bulbs in main and print out their data.

Write printBulb() so that it gets a complete copy of the Bulb it is to print.

#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;
} 


Answer         Next Page         Previous Page Home