# Playlist

:::{commons-figure} https://commons.wikimedia.org/wiki/File:Xmms-playlist.png
:figwidth: 40%
:align: right
A playlist of a music player.
:::

Imagine you want to manage a playlist which supports adding and removing tracks. The playlist should be able to manage thousands of tracks.

:::{activity} Array or not to array?
1. How would you implement this with an array? In particular, how do you add, remove tracks and how do you list the tracks?
1. Do you see any disadvantages of arrays? If yes, do you have any improvement ideas?
:::

## Requirements

1. Use the template below and only provide code in `YOUR CODE HERE` blocks.
1. Document your project, but you don't have to provide a flowchart.
1. Content in `playlist.txt` should be transformed and written to `playlist-out.txt`, so that you get the following output. This modification is caused by highlighted lines in `main.c`.
1. Optional: augment your code with an interactive command line interface on terminal or even a mouse-interface using raylib.

`playlist.txt`:
```{literalinclude} ../code-prj/playlist/playlist.txt
:language: text
:linenos:
```
`playlist-out.txt`:
```{literalinclude} ../code-prj/playlist/playlist-out.txt
:language: text
:linenos:
```

## Template

::::{tab-set}
:::{tab-item} `main.c`
```{literalinclude} ../code-prj/playlist/masked/main.c
:language: c
:linenos:
:emphasize-lines: 79-85
```
:::
:::{tab-item} `singly_linked_list.h`
```{literalinclude} ../code-prj/playlist/include/singly_linked_list.h
:language: c
```
:::
:::{tab-item} `singly_linked_list.c`
```{literalinclude} ../code-prj/playlist/masked/singly_linked_list.c
:language: c
```
:::