Arduino lists

Is is at all possible to store values in a list like in python? and to add to the list, and refer to specific list items? I need to do this because I am making a game of snake, and I need a way to refer to where the snakes head was a certain amount of moves ago, do draw the tail

Arrays

You could use a linked list if you don't want to be restrained by the fixed length of an array.

Cheers

Catweazle NZ

thanks to all of you, but most to CatweazleNZ, I have one question - How do I do this?. :slight_smile: :slight_smile: :slight_smile: ???

Google "linked list in C"

Hi

This might help you understand what a linked list is.

http://forum.arduino.cc/index.php?topic=258553.0

Basically you need to understand what pointers are, how to define a struct(ure) and how to chain together a list of struct records using a list head pointer and chaining pointers within struct records.

After that the new() and delete() functions are used to create and delete linked list modes.

Linked lists was a key topic in my second year computer studies forty years ago and is probably still so today. The ability to use linked lists is a key skill for senior software developers - but it is not rocket science if you work through it carefully to develop your understanding.

Cheers

Catweazle NZ