Peter Pristaš Peter Pristaš - 1 year ago 92
C Question

Structure containing element which array contains same structures

typedef struct Sym_item{
char *name;
symbolType type;
char *data;
bool fce;
TList *args;
bool init;
tHTable *ptr_loctable; // .. this is conflicting
char *class_name;
bool isstatic;
struct Sym_item *nextptr;

typedef struct Hash_table{
iSymbol *ptr;

typedef Hash_item tHTable[Hash_table_size]; // .............. this is conflicting

I am using this structure
which contains a
which is defined lately, but I need it that contains also the array of the symbols as this structure.

This says compiler:

error: unknown type name ‘tHTable’<br>
tHTable *ptr_loctable;

Answer Source

You should use forward declarations.

Before your iSymbol structure declaration, declare the other structure:

struct tHTable;

You do not have to write all of it's properties, as this is only a forward declaration.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download