I had to do it once too for a homework. I followed this approach:
- Define your data members in a
struct.
- Define your function members that
take a pointer to your struct as
first argument.
- Do these in one header & one c.
Header for struct definition &
function declarations, c for
implementations.
A simple example would be this:
/// Queue.h
struct Queue
{
/// members
}
typedef struct Queue Queue;
void push(Queue* q, int element);
void pop(Queue* q);
// etc.
///