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];
//beginning of the linked list
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
}