Answer T1

struct corresponding to a lightbulb
#include <stdio.h>

struct
{
  int watts;
  int lumens;
} bulbA;

int main()
{
  /* set values for bulbA */
  bulbA.watts = 100;
  bulbA.lumens = 1710;

  /* print values of bulbA */
  printf("BulbA: watts = %d\tlumens = %d\n",   bulbA.watts, bulbA.lumens );

  return 0;
} 

The following Does Not Work:


struct
{
  int watts = 100;   /* wrong */
  int lumens = 1710; /* wrong */
} bulbA;

A struct cannot be initialized in its definition, as the above attempts to do.



Back to Puzzle Home