Puzzle T7

b points to a bulb struct

Function to change a struct

As bulbs age, their light output decreases. Write a function that changes the number of lumens of a Bulb by decreasing it by ten percent.

#include <stdio.h>

struct Bulb
{
  int watts;
  int lumens;
};

/* function to print a Bulb */
void printBulb( struct Bulb *b )
{
}

void dimBulb( struct Bulb *b )
{
}

int main()
{
  /* declare and initialize a Bulb */

  /* print the Bulb */

  /* decrease its light output */

  /* print the Bulb */
  
	
  return 0;
} 

Here there is no choice. The parameter of the dimBulb() function must be the address of the struct.



Previous Page        Answer         Next Page         Home