Structs defined in header expose the internals. They should be moved to .c source files.


  • Clients can alter the internals of the data structure themselves leading to costly changes of all clients. Leads to very tight coupling.


  • Definition of struct is present in header files which are exposed to clients.


  • In this example details of Customer struct is exposed directly in header file. Clients can alter order quantity, or can use any attribute directly inside their code leading to very tight coupling.
// file: Customer.h
/* Include guards and include files omitted. */
#define MAX_NO_OF_ORDERS 42

/* Internal representation of a customer. */
typedef struct
  const char* name;
  Address address;
  size_t noOfOrders;
  Order orders[MAX_NO_OF_ORDERS];

void initCustomer(Customer* theCustomer, const char* name, const Address* address);
void placeOrder(Customer* customer, const Order* order);

/* A lot of other related functions... */


  • Structs that are defined in the header and expose the internals should be moved to .c source files.