Your code actually has nothing to do with classes, which actually don't even exist in C. I also don't see any definition of
food which you're using calc.c
Traditionally, struct definitions go in the header file, and you can include one struct inside another without the use of a pointer. Your typedef'ing is also a bit weird.
For instance, you can do this:
Code:
// foo.h
#ifndef FOO_H_
#define FOO_H_
struct foo_str
{
int blah;
float blaha;
};
typedef struct foo_str foo;
#endif // FOO_H_
Code:
// calc.h
#ifndef CALC_H_
#define CALC_H_
#include "foo.h"
struct calc_str
{
foo foostuff;
int count;
};
typedef struct calc_str calc;
#endif // CALC_H_
Code:
// calc.c
#include "foo.h"
#include "calc.h"
int main(void)
{
calc mycalc;
mycalc.foostuff.blah = 86;
return 0;
}