I am making an infrared macro-keyboard, I want to store Unicode for the Keyboard class in an array inside a class I made called Keybind
and to allow the user to program as many outputs as they want, I want the storage to be mutable. I currently use the String class and decode within the program but it's cpu intensive and not very practical.
I want to use an array or list, but I haven't found any way to expand the size of an array inside a class. Casting a temporary array didn't work:
int intArray[] = {0,1,2,3,4,5};
int* temp[7];
for(int x = 0; x<sizeof(intArray)/sizeof(intArray[0]); x++){
temp[x] = intArray[x];
}
temp[6] = 6;
intArray = temp;
IDE spits out "incompatible types in assignment of 'int* [7]' to 'int [6]'
"
ìnt* temp[7]
gives you an array of 7 pointers to ints, not an array of 7 ints. Remove the*
. Though I don't see, what this has to do with making the array bigger. That could be done via dynamic memory allocation (just like theString
class does in the background), though that is not a good idea on Arduinos, especially on the ones with low memory, like the ones based on the Atmega328p (Uno, Nano, ...)