Pelles C forum
C language => Expert questions => Topic started by: delper on June 22, 2008, 06:34:09 AM
-
Hi C Wizards,
How can I declare a typedef struct in one file and use it in another?
In one file I have:
typedef struct tagpair {
int Row;
int Column;
} pair;
and I like to use the tagpair struct in other files, even as input parameter in prototypes:
float *DotSUM (float DC, pair Ele, float MatrixIN[][Ele.Column], float MatrixOUT[][Column]);
But I just don't know what to declare in the other file, since the
extern struct pair;
does not work.... So what is the magic incantation here?
-
Put the struct definition in a .H file and include said .H file in any .C file that needs it.
John