Comment

Puzzles T11 ... T20

Struct Problems


Using a typedef simplifies struct declaration. Here is how a struct is declared and used without using typedef:

struct Emp
{
  int id;
  double pay;
};

struct Emp anEmployee;

and here is how the same is done using a typedef:

typedef struct
{
  int id;
  double pay;
} Emp;

Emp anEmployee;

The identifier Emp can now be used as the name of a type without the need to put struct in front of it.



Next Page         Home