There are a few problems with the code... but to answer your main question: there is no need to allocate memory when you use the declaration
as it is done for you implicitly. You only really need to use malloc() / calloc() when you declare a pointer to some memory whose size will only be defined at run time.
It might also be a good idea to do the typedef like this:
Code:
typedef struct {
int a1, b1;
} Rational;
otherwise you may have problems when you inlcude rational.h in main.c (which you will have to do I think). To prevent rational.h being compiled more than once, use:
Code:
#ifndef RATIONAL_H
#define RATIONAL_H
/*...... header declarations here ...... */
#endif /* RATIONAL_H */
There are still a few other things for you to find as well... !!!
DavT