I'm trying to set up a menu system for my RFID project, and one of the menus will allow a new tag to be added to the list of allowed tags. I would like to keep the array of tag numbers and names to the same length as the number of active tags if possible.
I realise this question has probably been asked before, but I'm not entirely sure how to describe, and search, for what I'm trying to do. I've found a few answers on the net, but haven't been able to work out how to implement them in the Arduino environment.
What I have so far is an array of tag names:
char* tagName[] = { "Tag 1", "Tag 2", "Tag 3"};
I would like to be anle to add another string ie. "Tag 4" to the above array. How is the best way to do this?
For the array as you've declared it, you can't - the array has only three entries.
What you could do is declare the array with a fixed size (larger than the three you've got at the moment), and initialise as many of the pointers as you wish.
The remaining pointers will be initialised to NULL, and you can fill them in when you want.
Beyond that, linked lists would allow potentially more flexibility, at the expense of some extra memory overhead.