1. ## Help with Linked Lists

I'm trying to use a for loop to create new structures of a linked list, but I keep overwriting the last struct and I don't know how to fix it.

Code:
```struct node *make_linked_list(char *pointArray[], int N, int polyNumber) {
struct node *first, *current, *newNode, *o;
char *term, *poly, sign = ' ';
int i, num;

poly = pointArray[0];
current = calloc(1,sizeof(struct node));
first = current;
/* Read the first term of the polynomial. From there, a new node will be created
* for each term. Do this for however many polynomials are in the file.
*/
term = strtok(poly, " ");
for(i=0; term != NULL; i++) {
term = strtok(NULL, " ");
.
.
.
newNode = calloc(1,sizeof(struct node));
current->next = newNode;
current = current->next;
return first
}```

2. It does not help when you leave out the bit that probably has the bug in it. You're missing a bracket too.
If you want real help you have to post the real code.

3. I figured out how to create a linked list. Now I'm having a problem with a while loop that adds 2 polynomials together. Everything seems to work correctly up until exiting where the loop checks the condition after the last term of the polynomial and then blows up.
Code:
```struct node *add(struct node *head1, struct node *head2) { //Use only for ordered lists
struct node *poly_a, *poly_b, *sum, *tsum;

sum = calloc(1,sizeof(struct node));
sum->next = calloc(1,sizeof(struct node));
tsum = sum;
while(poly_a->next != NULL || poly_b->next != NULL) {
/* If a term is present in the first polynomial and not the second,
* copy coeff and exp into the sum polynomial structure.
*/
if(poly_a->exp > poly_b->exp) {
tsum->exp = poly_a->exp;
tsum->coeff = poly_a->coeff;
poly_a = poly_a->next;
tsum->next = calloc(1,sizeof(struct node));
tsum = tsum->next;
continue;
}
/* If a term is present in the second polynomial and not the first,
* copy coeff and exp into the sum polynomial structure.
*/
else if(poly_b->exp > poly_a->exp) {
tsum->exp = poly_b->exp;
tsum->coeff = poly_b->coeff;
poly_b = poly_b->next;
tsum->next = calloc(1,sizeof(struct node));
tsum = tsum->next;
continue;
}
/* If a term is present in both polynomials, add coefficients and copy exp into the sum
* polynomial structure.
*/
else if(poly_b->exp == poly_a->exp) {
tsum->exp = poly_b->exp;
tsum->coeff = poly_b->coeff + poly_a->coeff;
tsum->next = calloc(1,sizeof(struct node));
tsum = tsum->next;
poly_b = poly_b->next;
poly_a = poly_a->next;
}

}
return sum;
}```