In the question Why should we typedef a struct so often in C?, unwind answered that:
In this latter case, you cannot return the Point by value, sinc
In the header file:
typedef struct _point * Point;
After the compiler sees this it knows:
struct called _point.Point that can refer to a struct _point. The compiler does not know:
struct _point looks like.struct _point contains.struct _point is.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 struct _point, which means that our code may be more portable.
Given the above code, you can write functions like:
Point f() {
....
}
because Point is a pointer and struct pointers are all the same size and the compiler doesn't need to know anything else about them. But you can't write a function that returns by value:
struct _point f() {
....
}
because the compiler does not know anything about struct _point, specifically its size, which it needs in order to construct the return value.
Thus, we can only refer to struct _point via the Point type, which is really a pointer. This is why Standard C has types like FILE, which can only be accessed via a pointer - you can't create a FILE structure instance in your code.