> How exactly does C support encapsulation?
You simply declare a type as a pointer to a struct in the header file along with the functions that operate on variables of this type, and define the struct and the functions in the implementation file.
M.h
typedef struct M_TDesc *M_T;
void M_Foo(M_T x);
...
M.c #include "M.h"
struct M_TDesc {
...
};
void M_Foo(M_T x)
{
...
}
...