questions? wrote:
thanks a lot
Please don't top post. Your reply belongs *under* the text you are
replying to, not above it. See
http://www.cpax.org.uk/prg/writings/topposting.php
EventHelix.com wrote:
EventHelix, please provide context, there is no guarantee that people
have, or ever will, see the article you are responding to. See
http://cfaj.freeshell.org/google/
I would also advice both of you to read
http://clc-wiki.net/wiki/Intro_to_clc I would recommend splitting header files. Use forward declarations for
the structures to decouple the structures from the function prototypes.
The following article might help:
http://www.eventhelix.com/RealtimeMa...dePatterns.htm
The article is about C++ header file inclusion. However the same
principles apply to C.
I would not rely on that site too much if I was you. I had only reached
the first line of the code when I saw a major error, using identifiers
reserved for the implementation name space.
There are some names beginning with an underscore you can use in certain
places, but the example on that site is not one of the situations where
you can use one.
The basic rule you should follow don't use *any* names starting with an
underscore. Learning what you can get away with is not worth the effort.
That site also does not answer the OPs original question.
It is legal to define a structure type in a parameter list, but not
tremendously useful. What you should do is define the struct type (but
not variables of that type, although you can declare variables as extern
in the header) in the header before your function declarations. e.g.
/* fred.h */
#ifndef FRED_H
#define FRED_H
/* Note I don't start the identifier with an underscore */
struct point {
int x;
int y;
};
int distance(struct point a, struct point b);
#endif
--
Flash Gordon, living in interesting times.
Web site -
http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc