Hi, all!

First, I've used search on this forum for my problem and found some very good articles about linked list, but nothing that can help me.

So, is it possible to write function in C for adding two adjoining elements of the list?
And to start that adding from second element of the list, so the first one stays the same?
Here is what I need to do:
If elements of the list are: a5, a4,...a1, I need to get the following elements:
b4=a5, b3=x*b4+a4,..., b1=x*b2+a2, b0=x*b1+a1, where x is integer value argument of the function.
Here is what I've tried:

struct niz *amnoz(struct niz *a,int m, int n) 
    struct niz *prvi=a;
    struct niz *current=a->pok; 
    struct niz *newList = NULL; 
    struct niz *tail = NULL; 
    while (current != NULL)

        if (newList == NULL) {
        newList = (struct niz*) malloc(sizeof(struct niz));
        newList->koef = current->koef+(m*prvi->koef);
        tail = newList;
else {
    tail->pok =(struct niz*) malloc(sizeof(struct niz));
    tail = tail->pok;
    tail->koef = current->koef+m*prvi->koef;
    tail->indeks = n;
    tail->pok = NULL;
current = current->pok;
This function does adding elements and multiplying them, but on a wrong way, only multiplying the first one with integer than adding it with the others.

Can this be done with single linked list, or do I have to use doble linked list?

Thanks in advance!