I'm not understanding how to apply what my teacher is telling me.
What my teacher is telling me is if you want to declare a struct in the .h file that you are making the struct public, but if you declare the struct in the .c implementation file then you are making it private. However, if I declare it in my .c file and then try and put the two together in a main.c file, I always get errors, and if I move that declaration back to the .h file, then everything works out. The error I get is always a forward declaration error from declaring in the .c file
So, can I put the struct declaration (via pointers) in my .c file, and how would I go about it?
TLDR ; I'm not understanding how to declare structs in my .c implementation file with a pointer in conjunction with my .h file.
edit:
Here would be the .h file
typedef char *ListItemP;
typedef struct List *ListP;
//some functions
And here would be the .c file
struct List
{
int foo;
ListItemP P;
};
//implementations of .h functions
However, whenever I do as I typed above I always get errors and I just can't figure out why to save my life.