C Workshop
LinkedList.h File Reference
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  Node_t
 
struct  List_t
 

Typedefs

typedef int ListDataType
 
typedef struct Node_t Node
 
typedef struct List_t List
 

Functions

ListCreateList ()
 Create a List object. More...
 
void FreeList (List *list)
 Free all memory allocated for the list. More...
 
size_t GetListSize (List *list)
 Get the size of the list. More...
 
NodeGetListHead (List *list)
 Get the list's head. More...
 
NodeGetNextNode (Node *currentNode)
 Get the next node for the given node. More...
 
ListDataType GetValue (Node *node)
 Get the value of the Node. More...
 
NodeInsert (Node *after, ListDataType newValue)
 Inserts a new node after the given node. More...
 
NodePushFront (List *list, ListDataType newValue)
 Appends a new node to the head of the list. More...
 
NodePushBack (List *list, ListDataType newValue)
 Append a new node to the end of the list. More...
 
ListDataType PopFront (List *list)
 Removes the node from the front of the list. More...
 
ListDataType PopBack (List *list)
 Removes the node from the end of the list. More...
 
void DeleteNode (List *list, Node *target)
 Delete node from list given node. More...
 
NodeDeleteValue (List *list, ListDataType value)
 Deletes a node from the list given the value. More...
 
NodeFind (List *list, ListDataType value)
 Finds the first node with the given value. More...
 

Typedef Documentation

◆ List

typedef struct List_t List

◆ ListDataType

typedef int ListDataType

◆ Node

typedef struct Node_t Node

Function Documentation

◆ CreateList()

List* CreateList ( )

Create a List object.

Returns
List* The created List object

◆ DeleteNode()

void DeleteNode ( List list,
Node target 
)

Delete node from list given node.

Parameters
listThe list to delete node from
targetThe node to delete

◆ DeleteValue()

Node* DeleteValue ( List list,
ListDataType  value 
)

Deletes a node from the list given the value.

Parameters
listThe list to delete the node from.
valueThe value of the node to delete.
Returns
Node* NULL

◆ Find()

Node* Find ( List list,
ListDataType  value 
)

Finds the first node with the given value.

Parameters
listThe list to search.
valueThe value to search for.
Returns
Node* The first node with the given value.

◆ FreeList()

void FreeList ( List list)

Free all memory allocated for the list.

Parameters
listThe List to be freed.

◆ GetListHead()

Node* GetListHead ( List list)

Get the list's head.

Parameters
listThe list
Returns
Node* The list's head

◆ GetListSize()

size_t GetListSize ( List list)

Get the size of the list.

Parameters
listThe list to get the size of
Returns
size_t The size of the list

◆ GetNextNode()

Node* GetNextNode ( Node currentNode)

Get the next node for the given node.

Parameters
currentNodeThe node to get the next node for
Returns
Node* The next node

◆ GetValue()

ListDataType GetValue ( Node node)

Get the value of the Node.

Parameters
nodeThe Node to get the value from
Returns
ListDataType The value of the Node

◆ Insert()

Node* Insert ( Node after,
ListDataType  newValue 
)

Inserts a new node after the given node.

Parameters
afterThe node after which the new node is inserted.
newValueThe value of the new node.
Returns
Node* The new node.

◆ PopBack()

ListDataType PopBack ( List list)

Removes the node from the end of the list.

Parameters
listThe list to remove the node from.
Returns
ListDataType The value of the removed node.

◆ PopFront()

ListDataType PopFront ( List list)

Removes the node from the front of the list.

Parameters
listThe list to remove the node from.
Returns
ListDataType The value of the removed node.

◆ PushBack()

Node* PushBack ( List list,
ListDataType  newValue 
)

Append a new node to the end of the list.

Parameters
listThe list to append to
newValueThe value to append
Returns
Node* The new node

◆ PushFront()

Node* PushFront ( List list,
ListDataType  newValue 
)

Appends a new node to the head of the list.

Parameters
listThe list to append to.
newValueThe value to append.
Returns
Node* The new head of the list.