ricco
asked on
Naming Singly Linked List
I am trying to figure out how to name a singly linked list.
For example, if I am doing a quadratic polynomial and I have defined a structure such as this:
typedef struct poly_node *poly_pointer;
typedef struct poly_node
{
int coefficient;
int exponent;
poly_pointer link;
};
Then in the main part of the program. I want to ask the user what is the name for a certain polynomial which may look like this:
main ()
{
printf("Enter a name for this polynomial: ");
scanf("%s", name);
.....
}
The question is how do I make the reference in naming that polynomial? I don't want to put the name in the struct because each node will want to have a name. The thing I am trying to do is that...I just want to make a reference to that named polynomial such that if I want to add two polynomial together and call that function to add:
addpoly(a,b);
where a and b are individual polynomial. how do I approach this problem???
For example, if I am doing a quadratic polynomial and I have defined a structure such as this:
typedef struct poly_node *poly_pointer;
typedef struct poly_node
{
int coefficient;
int exponent;
poly_pointer link;
};
Then in the main part of the program. I want to ask the user what is the name for a certain polynomial which may look like this:
main ()
{
printf("Enter a name for this polynomial: ");
scanf("%s", name);
.....
}
The question is how do I make the reference in naming that polynomial? I don't want to put the name in the struct because each node will want to have a name. The thing I am trying to do is that...I just want to make a reference to that named polynomial such that if I want to add two polynomial together and call that function to add:
addpoly(a,b);
where a and b are individual polynomial. how do I approach this problem???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.