Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Node *add_first(Node *a, char* data)
- {
- Node *c = (Node*)malloc(1 * sizeof(Node));
- *c = { data, a };
- return c;
- }
- Node *reverse(Node* a)
- {
- Node *b = a, *c = (Node*)malloc(1 * sizeof(Node));
- *c = { a->data, NULL };
- while (b->next != NULL)
- {
- b = b->next;
- c = add_first(c, b->data);
- }
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement