G11 Answer


#include <stdio.h>

typedef struct
{
  int watts;
  int lumens;
} Bulb;

/* function to print a Bulb */
void printBulb( Bulb b )
{
  printf("watts = %d\tlumens = %d\n", b.watts, b.lumens );
}

int main(int argc, char *argv[])
{
  /* declare and initialize two Bulbs */
  Bulb bulbA, bulbB;

  bulbA.watts = 100; bulbA.lumens = 1710;
  bulbB.watts =  60; bulbB.lumens = 1065;

  /* print values of both Bulbs */
  printBulb( bulbA );
  printBulb( bulbB );

  system("pause");
  return 0;
}

Comments: