Puzzle T6

b points to 10 element array

Function to print an array

Write a function printArray() that prints an entire array of Bulb structs.

#include <stdio.h>

struct Bulb
{
  int watts;
  int lumens;
};

#define length 10

/* function to print the array */
void printArray( ????, ??? )
{
}

int main()
{
  /* declare and initialize an array of length Bulbs */

  /* print the array */
  
	
  return 0;
} 

Use an initializer list to initialize the array. Decide on the parameters for printArray(). Hint: remember that the name of an array stands for the address of the array. It is likely that the function you write will have the array address as one of its parameters.



Previous Page        Answer         Next Page         Home