Pros & cons of using transparent data types

Viewed 49

Let's say I have a complex struct like:

struct Foo
{
  char *name;
  int n;
  int *arr;
};

What is the benefit of declaring it in a global header like foo.h. I know you gain the ability of writing inline functions directly in the header, but won't this be dangerous, when someone can directly change variables like n for example?

0 Answers
Related