Hello! I am taking a beginning C class at my school and the requirements for this homework is to make a game using linked lists.
The requirements with linked lists are
- To draw elements of linked lists
- Moving elements around in linked lists
- and adding/removing elements to/from a linked list
So before I started my implementation of a linked list, I just wrote the code for my game, I decided to do a pong game, in structure/dynamic memory format because I have no clue what a linked list is lol.
That is the code of my position structure that updates for where the paddles and the balls are (two paddles and one ball). I was wondering how I could easily just convert this into a linked list?Code:typedef struct _position{
int row;
int col;
}Position;
Position* pos = (Position*)malloc(sizeof(Position));
pos[0].col = 50;
pos[0].row = 5;
pos[1].col = 20;
pos[1].row = 135;
pos[2].col = 120;
pos[2].row = 80;
I have my game working but now and I just want to convert my structure data into linked list format... i've been trying to figure out what a linked list is and from what I understand it is just a way of storing information...
Is there any simple way of just making a basic linked list structure that I can add and pull elements to and from like my structures?
Our class doesn't have a textbook so i've been trying to google everything but to no avail.
Thanks.