Go to the source code of this file.
◆ Du_Node
◆ Node
◆ P_Du_Node
◆ P_Node
◆ linked_list_dynamic_init()
| void linked_list_dynamic_init |
( |
P_Node * |
p_node | ) |
|
This function is allocating the dynamic memory to the node...
- Parameters
-
| Pass | a pointer-to-lined-list. it can change the memory address stored at that memory location. |
- Returns
- none
Definition: linked_list.h:6
Referenced by main().
◆ linked_list_push_node()
| void linked_list_push_node |
( |
P_Node * |
head_ref, |
|
|
int |
data |
|
) |
| |
This function is pushing a new node at the front...
- Parameters
-
| Pass | a pointer-to-struct. it can change the memory address stored at that memory location. |
| Assign | data to a new node. |
- Returns
- none
62 init_node->
next = (
struct Node*) (* head_ref);
63 (* head_ref) = init_node;
struct Node * next
Definition: linked_list.h:8
int data
Definition: linked_list.h:7
Definition: linked_list.h:6
Referenced by main().
◆ linked_list_reverse()
| void linked_list_reverse |
( |
P_Node * |
head_ref | ) |
|
This function is reversing the linked list... Reverse function (Input: 1->2->3->4->NULL; Output: 4->3->2->1->NULL)
- Initialize three pointers: prev (NULL), curr (head), next (NULL).
- Iterate trough the linked list.
- next = curr->next // store next node
- curr->next = prev // actual reserving happens
- One step forward
- Parameters
-
| Pass | a pointer-to-lined-list. it can change the memory address stored at that memory location. |
- Returns
- none
88 while (curr != NULL) {
struct Node * next
Definition: linked_list.h:8
Definition: linked_list.h:6
Referenced by main().
◆ printList()
This function is printing contents of linked list starting from the given node...
- Parameters
-
- Returns
- none
26 printf(
"%d ", temp->
data);
struct Node * next
Definition: linked_list.h:8
int data
Definition: linked_list.h:7
Definition: linked_list.h:6
Referenced by main().
◆ printList_middle()
| void printList_middle |
( |
P_Node |
head_ref | ) |
|
This function is printing middle of linked list...
- Parameters
-
- Returns
- none
38 P_Node p_fast_node = head_ref;
39 P_Node p_slow_node = head_ref;
41 if(head_ref != NULL) {
42 while (p_fast_node != NULL && p_fast_node->
next != NULL) {
47 printf(
"The meddle elements is: %d \n", p_slow_node->
data);
struct Node * next
Definition: linked_list.h:8
int data
Definition: linked_list.h:7
Definition: linked_list.h:6
Referenced by main().