logo

Crowdly

Browser

Add to Chrome

Adott egy egyirányban láncolt lista. Az alábbi függvény feladata az lesz, hogy f...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Adott egy egyirányban láncolt lista. Az alábbi függvény feladata az lesz, hogy fordítsa meg ezt a listát. Azaz, egy 1-2-3-4 listából csináljon 4-3-2-1 listát.

Mit kell a hiányzó sorba írni, hogy helyesen működjön az algoritmus, és valóban fordítsa meg a bemeneten megjelenő listát?

/* Link list node */

struct node

{

    int data;

    struct node* next;

};

  

/* head_ref a lista első elemére érvényes referencia */

static void reverse(struct node** head_ref)

{

    struct node* prev   = NULL;

    struct node* current = *head_ref;

    struct node* next;

    while (current != NULL)

    {

        next  = current->next;  

        current->next = prev;   

        prev = current;

        current = next;

    }

    A HIÁNYZÓ UTASÍTÁS HELYE -- MI KERÜLJÖN IDE????

}

0%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.uni-pannon.hu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome