#Add entry at the back of `usigned char *`
15 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
You probably want to use a vector for this
You can’t do this because you cannot just add elements to an array, the size is fixed
If you really have to use pointer arrays for whatever reason, you have to reallocate when the elements surpassed the array size
But check out std::vector which handles it all for you
template<
class T,
class Allocator = std::allocator<T> >
class vector;
// ... and 1 more
Oh shoot I just saw the arduino tag
For arduino, I would just recommend stack allocating an array (with a large, fixed size) such as 128 or 512
If you know the max that size could be, you could set this array size to that maximum
unsigned char loop_list[128] = {};
…
For normal devices you might use malloc (for c) or vector, but arduino doesn’t support the c++ stl and malloc can lead to heap fragmentation so better safe than sorry
Hi.