For a homework problem I have to define a struct that can be used in a program to represent a fraction, together with a set function that can be used to set up the value of a fraction, and a print function that will print the fraction nicely. We are given the main function and according to the problem the output should be
(2/3) (1/5) (3/5)
Here's what I've written:
#include "library.h"
struct fraction
{
    int numerator;
    int denominator;
};
void set (fraction st, int n, int d)
{
    if (d>0)
    {
        n = st.numerator;
        d = st.denominator;
    }
}
void print(fraction st)
{
    int x = st.numerator;
    int y = st.denominator;
    print("(x/y)");
    print(" ");
}
void main()
{
    fraction a, b, c;
    set(a, 2, 3);
    set(b, 1, 5);
    set(c, 3, 5);
    print(a);
    print(b);
    print(c);
}
If you're wondering "library.h" is what my university uses as a shortcut for most of the standard includes.
I keep getting the error that the variable 'a' is being used without being initialized. Any help would be greatly appreciated.
 
     
     
    