Please post an example of your code that causes the error ?
Should have done that in the first post, sorry. An example
byte myArray[5]; // initialize an array the size of which might change during some process
int newSize;
const int numOfModules = 5;
byte numOfModuleElements[numOfModules] = {3, 3, 4, 2, 6}; // the sum of these values should change the size of the array
void setup()
{
for(int i = 0; i < numOfModules; i++){
newSize += numOfModuleElements[i];
}
// the result of the variable newSize is the size I'd like to assign to the array myArray
// maybe this changes also during some procedure so this loop should go in the main loop function
// if I declare the array again, it will cause an error, if I declare a new array, I won't have access to it in other functions
}
The thing is that I want to have access to that array in a few functions, that's why I'm declaring it globally.
There's "malloc()" but be very careful.
Is there some documentation on how to use this utility? If yes, can someone provide a link?