Create f5

This commit is contained in:
havya1310 2018-10-27 11:26:23 +05:30 committed by GitHub
parent 3468d27e61
commit d0958a34ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

19
f5 Normal file
View file

@ -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;
}