Create f4

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

18
f4 Normal file
View file

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