Add code generation for doubly linked list
This commit is contained in:
13
codegen/dbl_list/snippets/list_get
Normal file
13
codegen/dbl_list/snippets/list_get
Normal file
@@ -0,0 +1,13 @@
|
||||
if (index >= list->node_count) {{
|
||||
return NULL;
|
||||
}}
|
||||
|
||||
{T}Node *output = NULL;
|
||||
{T}Node *current = list->first;
|
||||
for (u64 i = 1; i <= index; ++i) {{
|
||||
current = current->next;
|
||||
}}
|
||||
|
||||
output = current;
|
||||
|
||||
return output;
|
Reference in New Issue
Block a user