From d0958a34ecd8a6290942fcd6fd413a04838a9f8b Mon Sep 17 00:00:00 2001 From: havya1310 <44518163+havya1310@users.noreply.github.com> Date: Sat, 27 Oct 2018 11:26:23 +0530 Subject: [PATCH] Create f5 --- f5 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 f5 diff --git a/f5 b/f5 new file mode 100644 index 00000000..79cfcacd --- /dev/null +++ b/f5 @@ -0,0 +1,19 @@ +struct Node *addEnd(struct Node *last, int data) +{ +if (last == NULL) + return addToEmpty(last, data); + +// Creating a node dynamically. +struct Node *temp = + (struct Node *)malloc(sizeof(struct Node)); + +// Assigning the data. +temp -> data = data; + +// Adjusting the links. +temp -> next = last -> next; +last -> next = temp; +last = temp; + +return last; +}