How can I hide the declaration of a struct in C? - Stack Overflow

In the header file:

typedef struct _point * Point;

After the compiler sees this it knows:

  • there is s struct called _point
  • there is a pointer type Point that can refer to a _point

The compiler does not know:

  • what the _point struct looks like
  • what members it contains
  • how big it is

And not only does the compiler not know it - we as programmers don't know it either. This means we can't write code that depends on those properties of _point, which means that our code may be more portable.

對於 C opaque pointer 的解譯