From d1c2ae2de6ca12bffe529ed42720c2dd7184e32f Mon Sep 17 00:00:00 2001 From: havya1310 <44518163+havya1310@users.noreply.github.com> Date: Sat, 27 Oct 2018 11:25:33 +0530 Subject: [PATCH] Create f4 --- f4 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 f4 diff --git a/f4 b/f4 new file mode 100644 index 00000000..39504616 --- /dev/null +++ b/f4 @@ -0,0 +1,18 @@ +struct Node *addBegin(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; + +return last; +}