NO

Author Topic: struct declaration in multiple files ...  (Read 3745 times)

delper

  • Guest
struct declaration in multiple files ...
« 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? 

JohnF

  • Guest
Re: struct declaration in multiple files ...
« Reply #1 on: June 22, 2008, 08:29:04 AM »
Put the struct definition in a .H file and include said .H file in any .C file that needs it.

John