67 lines
1.1 KiB
C
67 lines
1.1 KiB
C
|
#include <stdio.h>
|
||
|
|
||
|
typedef struct node
|
||
|
{
|
||
|
char Character;
|
||
|
struct node *Next;
|
||
|
}node;
|
||
|
|
||
|
// NOTE: adds an element to the beginning
|
||
|
void list_add(node **Head, char c)
|
||
|
{
|
||
|
// TODO: implement this
|
||
|
}
|
||
|
|
||
|
// NOTE: inserts after a specific node
|
||
|
void list_insert_after(node *Node, char c)
|
||
|
{
|
||
|
// TODO: implement this
|
||
|
}
|
||
|
|
||
|
// NOTE: get's a node with the specified character
|
||
|
node *list_get(node **Head, char c)
|
||
|
{
|
||
|
// TODO: implement this
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
// NOTE: removes a specific node from the list
|
||
|
void list_remove(node **Head, node *Node)
|
||
|
{
|
||
|
// TODO: implement this
|
||
|
}
|
||
|
|
||
|
// NOTE: frees the whole list
|
||
|
void list_free(node **Head)
|
||
|
{
|
||
|
// TODO: implement this
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
// NOTE: beginning of the list
|
||
|
// right now the list is empty
|
||
|
node *Head = 0;
|
||
|
|
||
|
list_add(&Head, 'c');
|
||
|
list_add(&Head, 'y');
|
||
|
list_add(&Head, 'b');
|
||
|
|
||
|
node *ToBeRemoved = list_get(&Head, 'y');
|
||
|
list_remove(Head, ToBeRemoved);
|
||
|
|
||
|
list_add(&Head, 'a');
|
||
|
node *InsertAfter = list_get(&Head, 'c');
|
||
|
list_insert_after(InsertAfter, 'd');
|
||
|
|
||
|
for(node *Iter = Head; Iter; Iter = Iter->Next)
|
||
|
{
|
||
|
printf("%c ", Iter->Character);
|
||
|
}
|
||
|
printf("\n");
|
||
|
|
||
|
list_free(Head);
|
||
|
|
||
|
}
|