I am relatively new to C and I came across a typedef for a structure with no name.
What is the point of it?
#define POLY(name,deg) \
term name[deg] = {0};
typedef struct {
int coeff;
int exp;
} term;
I am relatively new to C and I came across a typedef for a structure with no name.
What is the point of it?
#define POLY(name,deg) \
term name[deg] = {0};
typedef struct {
int coeff;
int exp;
} term;
term alone can be used to represent the type then. In language C, with struct term { ... };, you will have to use struct term to refer to the type.
This is different from C++, where a definition like struct term { ... }; implicitly introduces both struct term and term alone as valid references.