I'm new in C, one thing is driving me crazy is how to make visible to all files of my project a typedef struct...Maybe is a design error, not sure...
The stage is I have a typedef struct like this
// File header.h
typedef struct stu {
char name[60];
char id[10];
int age;
float puntuation;
} Student;
The I have several data structures where I want to use this typedef, I have a Stack, a hash table and a binary tree...I include all in main.c
// File main.c
#include "header.h"
#include "hashtable.h"
#include "stack.h"
#include "tree.h"
I need to use Student in hashtable and stack, and also need to use another typedef defined in stack in the tree but I'm not able to get it working...
The compiler says type name 'stack_def' unknown in tree.h and tree.c, if I exclude stack.h in main.c and include it in tree.h then it says the same in stack.h for the typedef Student.
Can someone, please, tell me what's going on here?
Thanks.