mirror of
https://github.com/trailofbits/algo.git
synced 2025-08-14 00:33:02 +02:00
Create f5
This commit is contained in:
parent
3468d27e61
commit
d0958a34ec
1 changed files with 19 additions and 0 deletions
19
f5
Normal file
19
f5
Normal 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;
|
||||
}
|
Loading…
Add table
Reference in a new issue