Search Results

Search found 1 results on 1 pages for 'user2976389'.

Page 1/1 | 1 

  • Reversing linked list C

    - by user2976389
    node *rever(node *root) { node *prev = NULL; node *xnew = NULL; while (root != NULL) { xnew = malloc(sizeof(root)); xnew->value = root->value; xnew->next = prev; prev = xnew; root = root->next; } return xnew; } Hello I wrote this linked list reverse function. However it doesn't work(empty response): I suspect it's because of prev index getting overwritten. Could someone explain me whats going on? I know I could find working code on the internet but I wanna know what am I doing wrong. Thanks

    Read the article

1