79616720

Date: 2025-05-11 17:09:14
Score: 0.5
Natty:
Report link

Yes, you're right. It should be: newnode->next->prev = newnode; instead of newnode->next->prev = node_to_insert_after;

Aside from this, I'm not sure whether this is a typo but where you should have a }, you have {. For example, your struct definition should be:

struct node {
    int value;
    struct node* next;
    struct node* prev;
};

What I must ask is: why are you asking this question? Why not write some tests for yourself to see if things work rather than asking on stack overflow? For example, you could write a function which prints the list:

Then you could use your insert functions and print the list to see if it works.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Gallagator